Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GHC 7.0.3 denies to show 2^1000 as a normalized double - outputs "infinity"

I have the following output - and I am surprised. Any help why "my Doubles" seem to be so low?

Prelude GHC.Float> floatRange (0.5e1000::Double)

(-1021,1024)

Prelude GHC.Float> show (0.5e1000::Double)

"Infinity"

The exponent 1000 seems to be quite far away from the 1024 limit (as I expected IEEE to contain this ::Double).

I would appreciate your help.

like image 261
Daniel Avatar asked Dec 05 '25 10:12

Daniel


1 Answers

Most likely, floatRange is returning the range of the binary (base-2) exponent. You are setting a base-10 exponent of 1024 here, so you're asking the base-2 exponent to reach 3402 or so.

like image 129
bdonlan Avatar answered Dec 08 '25 02:12

bdonlan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!