Basically the title. I'm trying to display floats in a string, but the result ends up being "3.0e-2"
(In the example of the float "0.03"
). How do I get in decimal form in Haskell? Thanks to anyone who answers.
CodePudding user response:
For pretty formatting values of built-in types, use printf
:
> printf "%f" (0.03 :: Float)
0.03
See the linked docs for a full explanation and all possible formatting options.