Haskell - how to avoid scientific notation in decimal output
问题 I need to divide a list of numbers by 100 to be printed, for example: map (/100) [29, 3, 12] produces: [0.29,3.0e-2,0.12] however I need: [0.29,0.03,0.12] How do I do this in Haskell? Any ideas really appreciated. 回答1: 0.03 and 3.0e-2 are the same number. Internally, GHC uses showFloat to print it, which will result in the scientific notation whenever the absolute value is outside the range 0.1 and 9,999,999. Therfore, you have to print the values yourself, for example with printf from Text