Commit cd01e48f authored by tibbe's avatar tibbe
Browse files

Add test for word2Double# and word2Float#

parent 575573ea
{-# LANGUAGE MagicHash #-}
module Main (main) where
import GHC.Exts (Double(D#), Float(F#), word2Double#, word2Float#)
main :: IO ()
main = do
print (D# (word2Double# 0##))
-- 9007199254740992 is 2^53, which is the largest integer which
-- can be stored in a 64-bit IEEE floating-point value without
-- loss of precision.
print (D# (word2Double# 9007199254740992##))
print (F# (word2Float# 0##))
-- 16777216 is 2^24, which is the largest integer which can be
-- stored in a 32-bit IEEE floating-point value without loss of
-- precision
print (F# (word2Float# 16777216##))
0.0
9.007199254740992e15
0.0
1.6777216e7
......@@ -100,3 +100,4 @@ test('T7319', [ extra_ways(['prof']), only_ways(['prof']), exit_code(1),
req_profiling,
extra_hc_opts('-fprof-auto'),
extra_run_opts('+RTS -xc') ], compile_and_run, [''])
test('Word2Float', normal, compile_and_run, [''])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment