[Haskell-cafe] How to round off frational number?

Tom Phoenix rootbeer at redcat.com
Fri Sep 8 22:27:29 EDT 2006

On 9/8/06, Sara Kenedy <sarakenedy at gmail.com> wrote:

> I try to find some functions in Haskell library to deal with numeric
> such that the result in the following format (but I did not find)
> For example,
> >1/3
> 0.33

You're talking about a number-to-string conversion, right?

You probably want showFFloat, from the Numeric module. There's also
the Text.Printf module. Or you could write your own display code; but
it's tricky to get it right for every possible case.


Hope this helps!

--Tom Phoenix

More information about the Haskell-Cafe mailing list