packages feed

exact-pi 0.2.1.1 → 0.2.1.2

raw patch · 3 files changed

+9/−4 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

changelog.md view
@@ -1,3 +1,8 @@+0.2.1.2
+-------
+* Fixed a bug in recip.
+* Fixed approximation of exact values with a negative exponent for pi.
+
 0.2.1.1
 -------
 * Fixed a missing case in isZero.
exact-pi.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/
 
 name:                exact-pi
-version:             0.2.1.1
+version:             0.2.1.2
 synopsis:            Exact rational multiples of pi (and integer powers of pi)
 description:         Provides an exact representation for rational multiples of pi alongside an approximate representation of all reals.
                      Useful for storing and computing with conversion factors between physical units.
src/Data/ExactPi.hs view
@@ -3,7 +3,7 @@ {-# OPTIONS_HADDOCK show-extensions #-}
 
 {-|
-Module      : Kaos.Math.AugmentedRational
+Module      : Data.ExactPi
 Description : Exact rational multiples of powers of pi
 License     : MIT
 Maintainer  : douglas.mcclean@gmail.com
@@ -42,7 +42,7 @@ -- This uses the value of `pi` supplied by the destination type, to provide the appropriate
 -- precision.
 approximateValue :: Floating a => ExactPi -> a
-approximateValue (Exact z q) = (pi ^ z) * (fromRational q)
+approximateValue (Exact z q) = (pi ^^ z) * (fromRational q)
 approximateValue (Approximate x) = x
 
 -- | Identifies whether an 'ExactPi' is an exact or approximate representation of zero.
@@ -103,7 +103,7 @@ 
 instance Fractional ExactPi where
   fromRational = Exact 0
-  recip (Exact z q) = Exact z (recip q)
+  recip (Exact z q) = Exact (negate z) (recip q)
   recip (Approximate x) = Approximate (recip x)
 
 instance Floating ExactPi where