prism
prism copied to clipboard
Split rationals
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.