hello,
I have been using some of the functions of the classes Real and
Fractional and I have observed that with the funcion "toRational" we can
obtain the fraction that represents a given number. For instance:
*P2> toRational (5.2::Float)
5452595 % 1048576
Why we obtain this numbers instead of "52 % 10" or "26 % 5"?
I have also obtained the following results with the functions
"fromRational" and "toRational":
*P2> (fromRational ((toRational 4) - ( toRational (5.2::Float) )))::Double
-1.1999998092651367
*P2> (fromRational ((toRational 4) - ( toRational (5.2::Double) )))::Double
-1.2000000000000002
*P2> (fromRational ((toRational 4) - ( toRational 5.2 )))
-1.2000000000000002
*P2> (fromRational ((toRational 4) - ( toRational (5.2::Float) )))::Float
-1.1999998
Are all these results ok? If this is the case, why?
Thanks,
Ignacio
_______________________________________________
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
- Re: Floats and Doubles Juan Ignacio Garcia Garcia
- Re: Floats and Doubles Lennart Augustsson
- Re: Floats and Doubles Jerzy Karczmarczuk
- Re: Floats and Doubles Seth Kurtzberg
- Re: Floats and Doubles Jan Kort
- Re: Floats and Doubles Josef Svenningsson
- RE: Floats and Doubles Simon Marlow
- RE: Floats and Doubles Simon Marlow