Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
825 views
in Technique[技术] by (71.8m points)

formatting - How do I get to haskell to output numbers NOT in scientific notation?

I have a some items that I want to partition in to a number of buckets, such that each bucket is some fraction larger than the last.

items = 500
chunks = 5
increment = 0.20


{- find the proportions  -}
sizes = take chunks (iterate (+increment) 1)    
base = sum sizes / items    
buckets = map (base *) sizes

main = print buckets

I'm sure there is a mathematically more elegant way to do this, but that's not my question. The end step is always printing out in scientific notation.

How do I get plain decimal output? I've looked at the Numeric package but I'm getting nowhere fast.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
> putStrLn $ Numeric.showFFloat Nothing 1e40 ""
10000000000000000000000000000000000000000.0

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...