diff options
-rw-r--r-- | libraries/base/Data/Fixed.hs | 7 | ||||
-rw-r--r-- | libraries/base/GHC/Float.hs | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/libraries/base/Data/Fixed.hs b/libraries/base/Data/Fixed.hs index bb45d20a38..a34f73ecd2 100644 --- a/libraries/base/Data/Fixed.hs +++ b/libraries/base/Data/Fixed.hs @@ -163,6 +163,13 @@ instance Enum (Fixed a) where enumFromThenTo (MkFixed a) (MkFixed b) (MkFixed c) = fmap MkFixed (enumFromThenTo a b c) -- | @since 2.01 +-- +-- Multiplication is not associative or distributive: +-- +-- >>> (0.2 * 0.6 :: Deci) * 0.9 == 0.2 * (0.6 * 0.9) +-- False +-- >>> (0.1 + 0.1 :: Deci) * 0.5 == 0.1 * 0.5 + 0.1 * 0.5 +-- False instance (HasResolution a) => Num (Fixed a) where (MkFixed a) + (MkFixed b) = MkFixed (a + b) (MkFixed a) - (MkFixed b) = MkFixed (a - b) diff --git a/libraries/base/GHC/Float.hs b/libraries/base/GHC/Float.hs index 195c23b1f4..8045216b25 100644 --- a/libraries/base/GHC/Float.hs +++ b/libraries/base/GHC/Float.hs @@ -279,7 +279,7 @@ class (RealFrac a, Floating a) => RealFloat a where -- -- This instance implements IEEE 754 standard with all its usual pitfalls -- about NaN, infinities and negative zero. --- Neither addition not multiplication are associative or distributive: +-- Neither addition nor multiplication are associative or distributive: -- -- >>> (0.1 + 0.1 :: Float) + 0.5 == 0.1 + (0.1 + 0.5) -- False @@ -533,7 +533,7 @@ instance Show Float where -- -- This instance implements IEEE 754 standard with all its usual pitfalls -- about NaN, infinities and negative zero. --- Neither addition not multiplication are associative or distributive: +-- Neither addition nor multiplication are associative or distributive: -- -- >>> (0.1 + 0.1) + 0.4 == 0.1 + (0.1 + 0.4) -- False |