Why do I get a segmentation fault when I try to show a negative double or float? There is no problem for negative integers.
Prelude> let a = 4
Prelude> :t a
a :: Integer
Prelude> let b = -4
Prelude> b
-4
Prelude> :t b
b :: Integer
Prelude> let c = 5.6
Prelude> :t c
c :: Double
Prelude> let d = -5.6
Prelude> :t d
d :: Double
Prelude> show d
"-Segmentation fault
I tried it various ways, it seems that the number is correctly understood but not shown. Version info:
ghci --version
The Glorious Glasgow Haskell Compilation System, version 6.10.4
GHC on MacPorts seems to be broken. See https://trac.macports.org/ticket/25265
Consider instead installing the Haskell Platform from haskell.org, which includes GHC 6.12.3 and a bundle of Haskelly goodies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With