ieee754 0.7.9 → 0.8.0
raw patch · 4 files changed
+53/−29 lines, 4 files
Files
- CHANGELOG +5/−0
- Numeric/IEEE.hs +11/−0
- ieee754.cabal +1/−1
- tests/Tests.hs +36/−28
CHANGELOG view
@@ -1,3 +1,8 @@+Changes in 0.8.0:++* Daniel Mendler added minDenormal.++ Changes in 0.7.9: * Rename nextup/nextdown to ieeesucc/ieeepred to avoid clashes with
Numeric/IEEE.hs view
@@ -27,6 +27,9 @@ -- | Infinity value. infinity :: a + -- | The smallest representable positive value.+ minDenormal :: a+ -- | The smallest representable positive normalized value. minNormal :: a @@ -118,6 +121,8 @@ {-# INLINE maxNaNPayload #-} nanPayload x = fromIntegral $ c_getnanf x {-# INLINE nanPayload #-}+ minDenormal = 1e-45+ {-# INLINE minDenormal #-} minNormal = 1.17549435e-38 {-# INLINE minNormal #-} maxFinite = 3.40282347e+38@@ -149,6 +154,8 @@ {-# INLINE maxNaNPayload #-} nanPayload x = fromIntegral $ c_getnanf (realToFrac x) {-# INLINE nanPayload #-}+ minDenormal = 1e-45+ {-# INLINE minDenormal #-} minNormal = 1.17549435e-38 {-# INLINE minNormal #-} maxFinite = 3.40282347e+38@@ -180,6 +187,8 @@ {-# INLINE maxNaNPayload #-} nanPayload x = c_getnan x {-# INLINE nanPayload #-}+ minDenormal = 5e-324+ {-# INLINE minDenormal #-} minNormal = 2.2250738585072014e-308 {-# INLINE minNormal #-} maxFinite = 1.7976931348623157e+308@@ -211,6 +220,8 @@ {-# INLINE maxNaNPayload #-} nanPayload x = c_getnan (realToFrac x) {-# INLINE nanPayload #-}+ minDenormal = 5e-324+ {-# INLINE minDenormal #-} minNormal = 2.2250738585072014e-308 {-# INLINE minNormal #-} maxFinite = 1.7976931348623157e+308
ieee754.cabal view
@@ -1,5 +1,5 @@ name: ieee754-version: 0.7.9+version: 0.8.0 homepage: http://github.com/patperry/hs-ieee754 synopsis: Utilities for dealing with IEEE floating point numbers description:
tests/Tests.hs view
@@ -13,13 +13,13 @@ type F = Float infix 1 @?~=, @?==- -(@?~=) actual expected = ++(@?~=) actual expected = unless (actual ~== expected) (assertFailure msg) where msg = "expected: " ++ show expected ++ "\n but got: " ++ show actual -(@?==) actual expected = +(@?==) actual expected = unless (actual === expected) (assertFailure msg) where msg = "expected: " ++ show expected ++ "\n but got: " ++ show actual@@ -31,12 +31,12 @@ , testCase "D2" test_maxNum_D2 , testCase "D3" test_maxNum_D3 , testCase "D4" test_maxNum_D4- , testCase "D5" test_maxNum_D5 + , testCase "D5" test_maxNum_D5 , testCase "F1" test_maxNum_F1 , testCase "F2" test_maxNum_F2 , testCase "F3" test_maxNum_F3 , testCase "F4" test_maxNum_F4- , testCase "F5" test_maxNum_F5 + , testCase "F5" test_maxNum_F5 ] test_maxNum_D1 = maxNum nan 1 @?= (1 :: D)@@ -60,12 +60,12 @@ , testCase "D2" test_minNum_D2 , testCase "D3" test_minNum_D3 , testCase "D4" test_minNum_D4- , testCase "D5" test_minNum_D5 + , testCase "D5" test_minNum_D5 , testCase "F1" test_minNum_F1 , testCase "F2" test_minNum_F2 , testCase "F3" test_minNum_F3 , testCase "F4" test_minNum_F4- , testCase "F5" test_minNum_F5 + , testCase "F5" test_minNum_F5 ] test_minNum_D1 = minNum nan 1 @?= (1 :: D)@@ -90,12 +90,12 @@ , testCase "D2" test_maxNaN_D2 , testCase "D3" test_maxNaN_D3 , testCase "D4" test_maxNaN_D4- , testCase "D5" test_maxNaN_D5 + , testCase "D5" test_maxNaN_D5 , testCase "F1" test_maxNaN_F1 , testCase "F2" test_maxNaN_F2 , testCase "F3" test_maxNaN_F3 , testCase "F4" test_maxNaN_F4- , testCase "F5" test_maxNaN_F5 + , testCase "F5" test_maxNaN_F5 ] test_maxNaN_D1 = maxNaN nan 1 @?== (nan :: D)@@ -120,12 +120,12 @@ , testCase "D2" test_minNaN_D2 , testCase "D3" test_minNaN_D3 , testCase "D4" test_minNaN_D4- , testCase "D5" test_minNaN_D5 + , testCase "D5" test_minNaN_D5 , testCase "F1" test_minNaN_F1 , testCase "F2" test_minNaN_F2 , testCase "F3" test_minNaN_F3 , testCase "F4" test_minNaN_F4- , testCase "F5" test_minNaN_F5 + , testCase "F5" test_minNaN_F5 ] test_minNaN_D1 = minNaN nan 1 @?== (nan :: D)@@ -169,6 +169,13 @@ test_infinity_F2 = infinity > (0 :: F) @?= True +test_minDenormal = testGroup "minDenormal"+ [ testCase "D1" (succIEEE 0 @?= (minDenormal :: D))+ , testCase "D2" (isDenormalized (minDenormal :: D) @?= True)+ , testCase "F1" (succIEEE 0 @?= (minDenormal :: F))+ , testCase "F2" (isDenormalized (minDenormal :: F) @?= True)+ ]+ test_minNormal = testGroup "minNormal" [ testCase "D" (go (minNormal :: D)) , testCase "F" (go (minNormal :: F))@@ -274,19 +281,19 @@ , testCase "D2" test_bisectIEEE_D2 , testCase "D3" test_bisectIEEE_D3 , testCase "D4" test_bisectIEEE_D4- , testCase "D5" test_bisectIEEE_D5 - , testCase "D6" test_bisectIEEE_D6 - , testCase "D7" test_bisectIEEE_D7 - , testCase "D8" test_bisectIEEE_D8 + , testCase "D5" test_bisectIEEE_D5+ , testCase "D6" test_bisectIEEE_D6+ , testCase "D7" test_bisectIEEE_D7+ , testCase "D8" test_bisectIEEE_D8 , testCase "D9" test_bisectIEEE_D9 , testCase "F1" test_bisectIEEE_F1 , testCase "F2" test_bisectIEEE_F2 , testCase "F3" test_bisectIEEE_F3 , testCase "F4" test_bisectIEEE_F4- , testCase "F5" test_bisectIEEE_F5 - , testCase "F6" test_bisectIEEE_F6 - , testCase "F7" test_bisectIEEE_F7 - , testCase "F8" test_bisectIEEE_F8 + , testCase "F5" test_bisectIEEE_F5+ , testCase "F6" test_bisectIEEE_F6+ , testCase "F7" test_bisectIEEE_F7+ , testCase "F8" test_bisectIEEE_F8 , testCase "F9" test_bisectIEEE_F9 ] @@ -607,7 +614,7 @@ , testCase "D3" test_nanPayload_D3 , testCase "F1" test_nanPayload_F1 , testCase "F2" test_nanPayload_F2- , testCase "F3" test_nanPayload_F3 + , testCase "F3" test_nanPayload_F3 ] test_nanPayload_D1 =@@ -639,16 +646,16 @@ test_copySign = testGroup "copySign" [ testCase "D1" test_copySign_D1 , testCase "D2" test_copySign_D2- , testCase "D3" test_copySign_D3 - , testCase "D4" test_copySign_D4 - , testCase "D5" test_copySign_D5 - , testCase "D6" test_copySign_D6 + , testCase "D3" test_copySign_D3+ , testCase "D4" test_copySign_D4+ , testCase "D5" test_copySign_D5+ , testCase "D6" test_copySign_D6 , testCase "F1" test_copySign_F1 , testCase "F2" test_copySign_F2- , testCase "F3" test_copySign_F3 - , testCase "F4" test_copySign_F4 - , testCase "F5" test_copySign_F5 - , testCase "F6" test_copySign_F6 + , testCase "F3" test_copySign_F3+ , testCase "F4" test_copySign_F4+ , testCase "F5" test_copySign_F5+ , testCase "F6" test_copySign_F6 ] test_copySign_D1 =@@ -682,6 +689,7 @@ test_IEEE = testGroup "IEEE" [ test_infinity , test_minNormal+ , test_minDenormal , test_maxFinite , test_epsilon , test_copySign