when I do 5.2 - 2.3 in ghci, I will get 2.9000000000000004 instead of 2.9. Also such ugly (and for human WRONG) results appear elsewhere when working with Double or Float.
Why is this happening? (this is just for curiosity, not for my real question)
My real question is: How can I tell ghci not to do this, and show the results of operations in doubles just like any other programming language (and calculator), and just like every 15-year-old will write them?
It is so annoying when I use ghci as a good calculator and work on lists on which I perform such operations.
map ((-)2.3) [4.0, 3.8, 5.2, 6.4, 1.3, 8.3, 13.7, 9.0, 7.5, 2.4] [-1.7000000000000002,-1.5,-2.9000000000000004,-4.1000000000000005,0.9999999999999998,-6.000000000000001,-11.399999999999999,-6.7,-5.2,-0.10000000000000009]
It just doesn't help when using numbers on a piece of paper
Thanks in advance:)
haskell
Dender
source share