exact-pi 0.1.0.0 → 0.1.1.0
raw patch · 2 files changed
+8/−2 lines, 2 files
Files
- exact-pi.cabal +1/−1
- src/Data/ExactPi.hs +7/−1
exact-pi.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: exact-pi -version: 0.1.0.0 +version: 0.1.1.0 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
@@ -19,7 +19,8 @@ ( ExactPi(..), approximateValue, - isExactZero + isExactZero, + isExactOne ) where @@ -41,6 +42,11 @@ isExactZero :: ExactPi -> Bool isExactZero (Exact _ 0) = True isExactZero _ = False + +-- | Identifies whether an 'ExactPi' is an exact representation of one. +isExactOne :: ExactPi -> Bool +isExactOne (Exact 0 1) = True +isExactOne _ = False instance Show ExactPi where show (Exact z q) | z == 0 = "Exactly " ++ show q