canon-0.1.0.0: Massive Number Arithmetic

Copyright(c) 2015-2018 Frederick Schneider
LicenseMIT
MaintainerFrederick Schneider <frederick.schneider2011@gmail.com>
StabilityProvisional
Safe HaskellNone
LanguageHaskell2010

Math.NumberTheory.Canon.Simple

Description

This a wrapper for the Canonical Representation type found in the Internals module. If you want to work with arbitrarily nested prime towers, you can use the Math.NumberTheory.Canon module.

Synopsis

Documentation

newtype SimpleCanon Source #

SimpleCanon is a new type wrapping a canonical representation.

Constructors

MakeSC CR_ 

Instances

Enum SimpleCanon Source # 
Eq SimpleCanon Source # 
Fractional SimpleCanon Source # 
Integral SimpleCanon Source # 
Num SimpleCanon Source # 
Ord SimpleCanon Source # 
Real SimpleCanon Source # 
Show SimpleCanon Source #

Define various instances

CanonConv SimpleCanon Source # 

type SC = SimpleCanon Source #

Shorthand type declaration

toSimpleCanon :: CanonConv a => a -> SimpleCanon Source #

Convert CanonConv types to SimpleCanon.

toSC :: CanonConv c => c -> SimpleCanon Source #

Convert a type to a SimpleCanon.

toSimpleCanonViaUserFunc :: CR_ -> (Integer -> Bool) -> SimpleCanon Source #

This function allow you to specify a user function when converting a canon rep to an SC.

fromSimpleCanon :: SimpleCanon -> CR_ Source #

Grab the canon rep from a SimpleCanon.

fromSC :: SimpleCanon -> CR_ Source #

Grab the canon rep from a SimpleCanon.

class CanonConv c where Source #

Typeclass for converting to SimpleCanon and RationalSimpleCanon

Minimal complete definition

toSC, toRC

Methods

toSC :: c -> SimpleCanon Source #

Convert a type to a SimpleCanon.

toRC :: c -> RationalSimpleCanon Source #

Convert a type to a RationalSimpleCanon.

scGCD :: SimpleCanon -> SimpleCanon -> SimpleCanon Source #

SimpleCanon GCD and LCM functions

scLCM :: SimpleCanon -> SimpleCanon -> SimpleCanon Source #

SimpleCanon GCD and LCM functions

scLog :: SimpleCanon -> Rational Source #

Wrapper for underlying CR function

scLogDouble :: SimpleCanon -> Double Source #

Wrapper for underlying CR function

scNegative :: SimpleCanon -> Bool Source #

Wrappers for underlying canon rep functions

scPositive :: SimpleCanon -> Bool Source #

Wrappers for underlying canon rep functions

scToInteger :: SimpleCanon -> Integer Source #

Convert a SimpleCanon back to an Integer.

scToI :: SimpleCanon -> Integer Source #

Convert a SimpleCanon back to an Integer.

newtype RationalSimpleCanon Source #

Newtype for RationalSimpleCanon. The underlying canon rep is the same.

Constructors

MakeRC CR_ 

Instances

Enum RationalSimpleCanon Source # 
Eq RationalSimpleCanon Source # 
Fractional RationalSimpleCanon Source # 
Integral RationalSimpleCanon Source #

Caveat: These functions will error out (in)directly if there are any negative exponents.

Num RationalSimpleCanon Source # 
Ord RationalSimpleCanon Source # 
Real RationalSimpleCanon Source # 
Show RationalSimpleCanon Source #

Define various instances for RationSimpleCanon.

CanonConv RationalSimpleCanon Source # 

type RC = RationalSimpleCanon Source #

Shorthand type name

toRationalSimpleCanon :: CanonConv a => a -> RationalSimpleCanon Source #

Convert CanonConv types to RationalSimpleCanon.

toRC :: CanonConv c => c -> RationalSimpleCanon Source #

Convert a type to a RationalSimpleCanon.

toRationalSimpleCanonViaUserFunc :: CR_ -> (Integer -> Bool) -> RationalSimpleCanon Source #

Convert canon rep to RationalSimpleCanon via a user-supplied criterion function.

fromRationalSimpleCanon :: RationalSimpleCanon -> CR_ Source #

Convert RC back to underlying canon rep.

fromRC :: RationalSimpleCanon -> CR_ Source #

Convert RC back to underlying canon rep.

rcNegative :: RationalSimpleCanon -> Bool Source #

Wraps underlying canon rep functions.

rcPositive :: RationalSimpleCanon -> Bool Source #

Wraps underlying canon rep functions.

getNumer :: RationalSimpleCanon -> SimpleCanon Source #

Pulls numerator or denominator from RC and converts it to a SimpleCanon.

getDenom :: RationalSimpleCanon -> SimpleCanon Source #

Pulls numerator or denominator from RC and converts it to a SimpleCanon.

getNumerDenom :: RationalSimpleCanon -> (SimpleCanon, SimpleCanon) Source #

Wraps crSplit function and returns a pair of SimpleCanons.

getNumerAsRC :: RationalSimpleCanon -> RationalSimpleCanon Source #

Calls underlying canon rep function.

getDenomAsRC :: RationalSimpleCanon -> RationalSimpleCanon Source #

Calls underlying canon rep function.

getNumerDenomAsRCs :: RationalSimpleCanon -> (RationalSimpleCanon, RationalSimpleCanon) Source #

Wraps crSplit function and returns a pair of RationalSimpleCanons.

rcLog :: RationalSimpleCanon -> Rational Source #

Calls underlying canon rep function.

rcLogDouble :: RationalSimpleCanon -> Double Source #

Calls underlying canon rep function.

(>^) :: SimpleCanonRoot a b c => a -> b -> c infixr 9 Source #

Root Operator

(<^) :: SimpleCanonExpnt a b c => a -> b -> c infixr 9 Source #

Exponentiation Operator

(%) :: Integral a => a -> a -> a infixl 7 Source #

Modulus operator