Created
January 11, 2020 17:20
-
-
Save Shimuuar/c784c9d015b885a6f37fead57ae24e36 to your computer and use it in GitHub Desktop.
IEEE754 WAT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ghc -fforce-recomp -O2 wat.hs && ./wat | |
[1 of 1] Compiling Main ( wat.hs, wat.o ) | |
Linking wat ... | |
NaN | |
-Infinity | |
Infinity | |
-0.0 | |
NaN | |
-Infinity | |
Infinity | |
-0.0 | |
$ ghc -fforce-recomp -O0 wat.hs && ./wat | |
[1 of 1] Compiling Main ( wat.hs, wat.o ) | |
Linking wat ... | |
-5.104235503814077e38 | |
-3.402823669209385e38 | |
3.402823669209385e38 | |
0.0 | |
-Infinity | |
-Infinity | |
Infinity | |
0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f2d :: Float -> Double | |
f2d = realToFrac | |
d2f :: Double -> Float | |
d2f = realToFrac | |
main :: IO () | |
main = do | |
print (f2d (0/0)) | |
print (f2d (-1/0)) | |
print (f2d (1/0)) | |
print (f2d (-0)) | |
print (d2f (0/0)) | |
print (d2f (-1/0)) | |
print (d2f (1/0)) | |
print (d2f (-0)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment