possibly-wrong/precision

math::Rational doesn't round correctly

Closed this issue · 2 comments

image

Yes, this is a homemade calculator using your library. Lemme know if you'd like to try it out at some point, this has been so useful to me :)

Very interesting! Would definitely like to experiment if/when you're ready to share.

Note that to_double, round, and to_string(digits) all use the IEEE-754 default round-to-even "mode."

Round to even? I've never seen that before.

You reply pretty quickly to my comments, so you can check out the current version of the calculator (as I work on it and it updates) here: https://b0bb327a.ngrok.io/

I expect it'll be up for about another hour before I have to head over to Washington for Thanksgiving stuff.

More off-topic:
Some order of operations tests for the calculator (use :debug ast on to see the AST):

10(4)-2(4^2/4)/2/(1/2)+9 = 41
-10/(20/2^2*5/5)*8-2     = -18
-4--9(3-(3^3+9))         = -301
((-84/-7)^3--9)*-11+-11  = -19118
((-96/-4)^2-11)*-3+-3    = -1698
((90/5)^3-10)*2+2        = 11646
((-96/-4)^3--11)*-4+-4   = -55344
-6--4(-5-(-5^3+-4))      = 490

They also test unary operator detection as well.