Reading floating point

David Feuer david.feuer at gmail.com
Sat Oct 8 19:27:18 UTC 2016


The current Read instances for Float and Double look pretty iffy from an
efficiency standpoint. Going through Rational is exceedingly weird: we have
absolutely nothing to gain by dividing out the GCD, as far as I can tell.
Then, in doing so, we read the digits of the integral part to form an
Integer. This looks like a detour, and particularly bad when it has many
digits. Wouldn't it be better to normalize the decimal representation first
in some fashion (e.g., to 0.xxxxxxexxx) and go from there? Probably less
importantly, is there some way to avoid converting the mantissa to an
Integer at all? The low digits may not end up making any difference
whatsoever.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20161008/60aaab00/attachment.html>


More information about the ghc-devs mailing list