diff --git a/libraries/base/Data/Fixed.hs b/libraries/base/Data/Fixed.hs index bb45d20a383e0aa0dfc93fd394cbafdda4609d7f..a34f73ecd21b2dcafa6b49a12da9c4c1deb7bee4 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 195c23b1f4fa43398e80b251fd7780412c092280..8045216b2519fd6edfe8d00cf12f72830f3b0ea6 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