Is there a simple function to round a Double or Float to a specified number of digits? I\'ve searched here and on Hoogle (for (Fractional a) =>
Double
Float
(Fractional a) =>
It depends on what you are going to do with the rounded number.
If you want to use it in calculations, you should use Data.Decimal from Decimal library.
Data.Decimal
Decimal
If you want just to format the number nicely, you should use Text.Printf from the standard library (base package).
Text.Printf
base