# Integers and Rationals

10 views

### Paul Merrell

Dec 3, 2013, 8:14:32 PM12/3/13
I've added code to construct integers and rationals from natural numbers. The integers are in decent shape. Addition, subtraction, multiplcation, =, and <= are in place with their basic properties proved. The rationals are a different story. There are a number of issues. The denominators can never be 0. I didn't want to carry around a million (denominator != 0) statements, so I can up with what I thought was a clever solution. Anyways, I'm really frustrated that I couldn't get it to work and I've given up for now. I hope it's alright that I checked it in in such an unfinished state.

Paul

### Jim Kingdon

Dec 4, 2013, 2:48:44 AM12/4/13
Interesting. I glanced through them, and it's impressive how much is there.

Offsetting the denominator by one (so that 0 is impossible) is a clever
idea. Didn't spend enough time with it to figure out whether/how it
could be fixed.

I'm OK with checking in stuff which isn't fully developed (especially if
it verifies), so no worries on that score. The comment at the top
summarizing the state of the file is helpful.
> --
> You received this message because you are subscribed to the Google
> Groups "Ghilbert" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to ghilbert+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

### Paul Merrell

Jan 3, 2014, 1:35:40 AM1/3/14
I finally got rational numbers working plus a bunch of other stuff I checked in over the break. I introduced a Not-a-Number (NaN) term if you ever divide by 0. This made things so much simpler than my earlier attempt. NaN is never equal to any normal number. If you try adding, multiplying, or dividing by it, you will get NaN. So as long as you don't divide by 0 you should never see it.

Paul

To unsubscribe from this group and stop receiving emails from it, send an email to ghilbert+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "Ghilbert" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ghilbert+unsubscribe@googlegroups.com.