I've always used:

roundn n f = fromIntegral (round (f * 10 ^ n)) / 10 ^ n

I may have missed some bugs or subtleties of floating point numbers, though.

/g

On 9/8/06, Sara Kenedy <[EMAIL PROTECTED]> wrote:
Hello all,

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
>1/6
0.17
>8/3
2.67
>9/3
3.00

It seems a so "baby" question, but I really did not find the answer
after trying on that for some hours.
Thanks for any help.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



--
It is myself I have never met, whose face is pasted on the underside of my mind.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to