[Haskell-cafe] approxRatio and Ratio Word

ALeX Kazik alex at kazik.de
Sat Nov 4 23:06:22 UTC 2017


> Is this expected? If so, why?

Yes, that is expected.
The approxRational calculation is based on x+eps and x-eps, which is
1%100 and 3689348814741910323%20 in your example, and the last one is
due to the fact that there are no negative numbers in word and there
is a silent underflow. (similar to: (0::Word)-1).
And the simplest rational number between these two is 1.


More information about the Haskell-Cafe mailing list