packages feed

cyclotomic 0.4 → 0.4.1

raw patch · 2 files changed

+7/−5 lines, 2 files

Files

cyclotomic.cabal view
@@ -1,5 +1,5 @@ Name:                cyclotomic-Version:             0.4+Version:             0.4.1 Synopsis:            A subfield of the complex numbers for exact calculation. Description:         The cyclotomic numbers are a subset of the                      complex numbers that are represented exactly, enabling exact
src/Data/Complex/Cyclotomic.hs view
@@ -211,10 +211,12 @@ --   of the form @r * exp(2*pi*i*s)@; @polarRat r s@ is the same as @r * e q ^ p@, --   where @s = p/q@. polarRat :: Rational -> Rational -> Cyclotomic-polarRat r s = fromRational r * e q ^ p-    where-      p = numerator s-      q = denominator s+polarRat r s+    = let p = numerator s+          q = denominator s+      in case p >= 0 of+           True  -> fromRational r * e q ^ p+           False -> conj $ fromRational r * e q ^ (-p)  -- | Complex conjugate. conj :: Cyclotomic -> Cyclotomic