First commit of partial RosettaCode contents.

Pushing this for testing purposes. Lots of work still needed.
This commit is contained in:
Ingy döt Net 2013-04-08 13:02:41 -07:00
commit 1e05ecd7ee
781 changed files with 9080 additions and 0 deletions

View file

@ -0,0 +1,4 @@
*Main> infinity :: Float
Infinity
*Main> infinity :: Double
Infinity

View file

@ -0,0 +1,4 @@
Prelude> 1 / 0 :: Float
Infinity
Prelude> 1 / 0 :: Double
Infinity

View file

@ -0,0 +1,4 @@
Prelude> read "Infinity" :: Float
Infinity
Prelude> read "Infinity" :: Double
Infinity

View file

@ -0,0 +1,8 @@
maxRealFloat :: RealFloat a => a -> a
maxRealFloat x = encodeFloat b (e-1) `asTypeOf` x where
b = floatRadix x - 1
(_,e) = floatRange x
infinity :: RealFloat a => a
infinity = if isInfinite inf then inf else maxRealFloat 1.0 where
inf = 1/0