top | item 41171664

(no title)

pierrebai | 1 year ago

I wonder why they chose to represent rationals with subtracting one from the denominator. It makes human parsing of the value harder and in many case makes the implementation code slighter harder; for example the equality op need to increment both denominators before using them. I suspect such increment must be constantly be needed left and right?

discuss

order

mrkeen|1 year ago

I suspect it's to exclude a denominator of 0.

pierrebai|1 year ago

No, since they use an integer (Z) as the denominator. So their representation support having -1 (i.e 0) as the denominator.