[Haskell-cafe] Why is toRational a method of Real?

Henning Thielemann lemming at henning-thielemann.de
Thu Aug 5 07:06:41 EDT 2010


On Thu, 5 Aug 2010, David Virebayre wrote:

> On Thu, Aug 5, 2010 at 11:35 AM, Henning Thielemann
> <lemming at henning-thielemann.de> wrote:
>
>> What else shall a rounding function return if not integers?
>
> Getting from 29.84645 to 29.85 isn't rounding ?

Sure, it is, I missed that. Maybe such rounding functions are not provided 
in Prelude because, say, rounding to a certain number of decimal places 
cannot be computed exactly with binary floating point numbers.


More information about the Haskell-Cafe mailing list