Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Instance of Bounded for Double in Haskell

Tags:

haskell

Prelude does not provide a Bounded Double instance. Is this because Double does not have a min/max argument in Haskell (that Bounded requires) or is the reason different?

like image 516
Petras Purlys Avatar asked Aug 25 '19 16:08

Petras Purlys


1 Answers

Assuming that maxBound > x should hold true for any other x :: Bounded a => a, what should the value of maxBound :: Double be?

> let nan = 0/0; infinity = 10.0**10000; in (nan > infinity, infinity > nan)
(False,False)

The numbers represented by Double are bounded, but the values in the type Double are not.

like image 71
chepner Avatar answered Nov 12 '22 13:11

chepner