prism icon indicating copy to clipboard operation
prism copied to clipboard

Split rationals

Open kddnewton opened this issue 1 year ago • 0 comments

This splits RationalNode into RationalIntegerNode and RationalFloatNode. The shapes of the two nodes are different: RationalIntegerNode wraps a child IntegerNode. RationalFloatNode wraps two integer fields, a numerator and a denominator.

These nodes are handled quite differently, so it's easier to handle them separately. For RationalIntegerNode, you can construct a rational from it directly, where the denominator is always 1. For RationalFloatNode, you take the two operands and reduce them.

Importantly, this PR does not implement bignum reduction. That's something I'd like to consider for the future, but it's simple enough for now to leave them unreduced, which makes it more useful than it used to be.

kddnewton avatar May 08 '24 19:05 kddnewton