This one's a major stretch since it'll require a lot of work and rewriting to implement, but I thought I'd add it here as something to consider.
Instead of true floats, all "float" values are secretly symbolic on the back end, e.g. cos(1)
would actually just be cos(1)
, instead of 0.5403023058681398
. Possible accompanying operators include:
x
, n
and printing x
rounded/truncated to n
sig figs/decimal placesx
rational and pushing its numerator and denominatorOtherwise, values are converted back to float before being output.
The main advantage would be that floating point precision never gets in the way of most problems, e.g. Fibonacci numbers can be calculated with the golden ratio formula (not the golfiest way for CJam, but just an example). The main disadvantages, of course, would be a slower language and a lot of implementation work.