[Haskell-cafe] Accuracy of Data.Number.Fixed

Frank Staals frank at fstaals.net
Sat Mar 5 18:37:48 UTC 2016


Lyle Kopnicky <lists at qseep.net> writes:

> This does not seem right to me:
>
> Prelude Data.Number.Fixed> read "4.00" :: Fixed (EpsDiv10 (EpsDiv10 Eps1))
> 4.00
> Prelude Data.Number.Fixed> read "4.01" :: Fixed (EpsDiv10 (EpsDiv10 Eps1))
> 4.00
> Prelude Data.Number.Fixed> read "4.02" :: Fixed (EpsDiv10 (EpsDiv10 Eps1))
> 4.03
> Prelude Data.Number.Fixed> read "4.03" :: Fixed (EpsDiv10 (EpsDiv10 Eps1))
> 4.04
> Prelude Data.Number.Fixed> read "4.04" :: Fixed (EpsDiv10 (EpsDiv10 Eps1))
> 4.05

Why not just use Data.Fixed from base?

> import Data.Fixed
> read "4.02" :: Fixed E2 
> 4.02

-- 

- Frank


More information about the Haskell-Cafe mailing list