[Haskell-cafe] Problem with percentage function?
karl at karlv.net
Sun Apr 20 21:21:45 UTC 2014
On Sun, Apr 20, 2014, at 02:12 PM, Chapman, Anthony Sergio wrote:
> I would it to round to 2 decimal places no matter what the size of the
> input is
> The problem is that what I actually get is 22.220000000000002
The Double type cannot represent all values exactly, which produces this
If you just want to round the number for display purposes, you should
probably round it as part of the conversion to text.
Otherwise, there are a lot of other numeric representations, but the
right one would depend on your application.
More information about the Haskell-Cafe