I have some simple function
f :: Float -> Float
f x = x
Prelude> f 5.00
5.0
Why not 5.00
? How can I achieve this?
If you want something from base
then use showGFloat
:
> import Numeric
> showGFloat (Just 2) 1.99438 ""
"1.99"
> :t showGFloat
showGFloat :: RealFloat a => Maybe Int -> a -> ShowS
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With