Data.Text.Read.rational
no more accurate than Data.Text.Read.double
#34
Labels
question
Requires more investigation
The documentation on
double
states that it loses accuracy on some inputs, but usingrational
will fix this. I understood this to mean that if one simply usedrational :: Reader Double
, then one would get completely accurate results, but this doesn't appear to be the case. For instance, given the input string"5.781884674518029e-2"
,double :: Reader Double
andrational :: Reader Double
both produce an output of"5.7818846745180286e-2"
, whereasPrelude.read :: String -> Double
produces"5.781884674518029e-2"
.Perhaps the documentation means that one should actually use
rational :: Reader Rational
and then convert toDouble
withfromRational
? If so, that isn't clear from the documentation.The text was updated successfully, but these errors were encountered: