diff options
Diffstat (limited to 'testsuite/tests/numeric/should_run/arith002.hs')
-rw-r--r-- | testsuite/tests/numeric/should_run/arith002.hs | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/testsuite/tests/numeric/should_run/arith002.hs b/testsuite/tests/numeric/should_run/arith002.hs new file mode 100644 index 0000000000..b7f5acf136 --- /dev/null +++ b/testsuite/tests/numeric/should_run/arith002.hs @@ -0,0 +1,52 @@ +-- !!! basic Rational operations +-- +import Data.Ratio + +main + = putStr + (-- Ratio Ints + show [i0a, i0b, i0c, i2a, i2b, im2a, im2b, i_pi, i_misc] + ++ "\n" + -- the Ints + ++ show ((map numerator [i0a, i0b, i0c, i2a, i2b, im2a, im2b, i_pi, i_misc]) + ++(map denominator [i0a, i0b, i0c, i2a, i2b, im2a, im2b, i_pi, i_misc])) + ++ "\n" + -- Booleans +-- ++ show [] +-- ++ "\n" + + -- Rationals (Ratio Integers) + ++ show [r0a, r0b, r0c, r2a, r2b, rm2a, rm2b, r_pi, r_misc] + ++ "\n" + -- the Integers + ++ show ((map numerator [r0a, r0b, r0c, r2a, r2b, rm2a, rm2b, r_pi, r_misc]) + ++(map denominator [r0a, r0b, r0c, r2a, r2b, rm2a, rm2b, r_pi, r_misc])) + ++ "\n" + -- Booleans +-- ++ show [] +-- ++ "\n" + ) + where + i0a, i0b, i0c, i2a, i2b, im2a, im2b, i_pi, i_misc :: Ratio Int + + i0a = 0 % 1 + i0b = (-0) % 1 + i0c = 0 % (-1) + i2a = 4 % 2 + i2b = (-4) % (-2) + im2a = (-4) % 2 + im2b = 4 % (-2) + i_pi = 22 % 7 + i_misc = 2 % 10000 + + r0a, r0b, r0c, r2a, r2b, rm2a, rm2b, r_pi, r_misc :: Rational + + r0a = 0 % 1 + r0b = (-0) % 1 + r0c = 0 % (-1) + r2a = 4 % 2 + r2b = (-4) % (-2) + rm2a = (-4) % 2 + rm2b = 4 % (-2) + r_pi = 22 % 7 + r_misc = 2 % 10000 |