On 11/25/2016 08:33 PM, Andres Valloud wrote:
If "rounding" had well specified behavior that was at least somewhat
reasonable (e.g. return the closest floating point value and round to
even if tied), I'd accept floating point results that don't print
"pretty" in base 10. That's the way things are, there's no point in
pretending IEEE-754 is not base 2.
If "rounding" is being done in place of "printing", or obtaining a
"string representation", I think that won't work as expected because
0.1 not representable etc.
For "printing", the algorithms were Dragon4 and Grisu3 last time I
checked.
Thanks for the reference! Grisu3 looks interesting.
For "floating point that works nice in base 10", there's IEEE-854.
For those unfamiliar with the spec, it's been implemented in
non-exotic hardware already.
Base 2 and base 10 are now both covered in IEEE-754 as of the 2008
revision (which also ties up some loose ends that were not specified
adequately in IEEE 754-1985)
Regards,
-Martin