Is there a means of formatting doubles in Haskell with the precision
flexibilty of printf? The show method seems to only print the first
few decimal places, and showGFloat in the numeric module seems to only 
display a similar number


For example, in hugs...

    import Numeric
    x = 1.234567890123456789 :: Double


then

    Main> show x
    "1.23457"
    Main> sequence [ putStrLn (showGFloat (Just prec) x "") | prec <- [0..20] ]
    1
    1.2
    1.23
    1.235
    1.2346
    1.23457
    1.234568
    1.2345679
    1.23456790
    1.234567900
    1.2345679000
    1.23456790000
    1.234567900000
    1.2345679000000
    1.23456790000000
    1.234567900000000
    1.2345679000000000
    1.23456790000000000
    1.234567900000000000
    1.2345679000000000000
    1.23456790000000000000
    Main> 


Thanks for any pointers.

Tim

Reply via email to