Copyright | (c) Michal Konecny |
---|---|
License | BSD3 |
Maintainer | [email protected] |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Numeric.MixedTypes.Elementary
Contents
Description
Synopsis
- class CanSqrt t where
- type CanSqrtSameType t = (CanSqrt t, SqrtType t ~ t)
- specCanSqrtReal :: (Arbitrary t, CanTestPosNeg t, HasOrderAsymmetric (SqrtType t) Integer, CanSqrt t, HasEqAsymmetric (PowType (SqrtType t) Integer) t, CanTestCertainly (OrderCompareType (SqrtType t) Integer), CanTestCertainly (EqCompareType (PowType (SqrtType t) Integer) t), Show t, Show (PowType (SqrtType t) Integer), Show (SqrtType t), CanPow (SqrtType t) Integer) => T t -> Spec
- class CanExp t where
- type CanExpSameType t = (CanExp t, ExpType t ~ t)
- specCanExpReal :: (SubType t t ~ t, SubType t Integer ~ t, SubType Integer t ~ t, AbsType t ~ t, AddType t t ~ t, AddType t Integer ~ t, AddType Integer t ~ t, DivIType t t ~ Integer, MulType t Integer ~ t, MulType Integer t ~ t, DivType t Integer ~ t, ModType t t ~ t, CanSub t t, CanSub t Integer, CanSub Integer t, Arbitrary t, CanAddAsymmetric t t, CanAddAsymmetric t Integer, CanAddAsymmetric Integer t, CanAbs t, CanDivIMod t t, HasOrderAsymmetric t t, HasOrderAsymmetric (ExpType t) Integer, CanExp t, CanExp (NegType t), CanDiv t Integer, CanDiv Integer (ExpType t), HasEqAsymmetric (ExpType t) (MulType (ExpType t) (ExpType t)), HasEqAsymmetric (ExpType (NegType t)) (DivType Integer (ExpType t)), CanTestCertainly (OrderCompareType t t), CanTestCertainly (OrderCompareType (ExpType t) Integer), CanTestCertainly (EqCompareType (ExpType t) (MulType (ExpType t) (ExpType t))), CanTestCertainly (EqCompareType (ExpType (NegType t)) (DivType Integer (ExpType t))), Show t, Show (DivType Integer (ExpType t)), Show (MulType (ExpType t) (ExpType t)), Show (ExpType t), Show (ExpType (NegType t)), CanMulAsymmetric t Integer, CanMulAsymmetric (ExpType t) (ExpType t), CanMulAsymmetric Integer t, ConvertibleExactlyWithSample Integer t, CanNeg t) => T t -> Spec
- class CanLog t where
- type CanLogSameType t = (CanLog t, LogType t ~ t)
- specCanLogReal :: (SubType t t ~ t, SubType t Integer ~ t, SubType Integer t ~ t, AbsType t ~ t, AddType t t ~ t, AddType t Integer ~ t, AddType Integer t ~ t, DivIType t t ~ Integer, MulType t Integer ~ t, MulType Integer t ~ t, DivType t Integer ~ t, ModType t t ~ t, CanSub t t, CanSub t Integer, CanSub Integer t, Arbitrary t, CanAbs t, CanDivIMod t t, CanDiv t Integer, CanDiv Integer t, CanMulAsymmetric t t, CanMulAsymmetric t Integer, CanMulAsymmetric Integer t, CanAddAsymmetric t t, CanAddAsymmetric t Integer, CanAddAsymmetric (LogType t) (LogType t), CanAddAsymmetric Integer t, CanExp t, HasOrderAsymmetric t t, HasOrderAsymmetric t Integer, HasOrderAsymmetric (DivType Integer t) Integer, HasOrderAsymmetric (MulType t t) Integer, HasOrderAsymmetric (ExpType t) Integer, HasEqAsymmetric (LogType (DivType Integer t)) (NegType (LogType t)), HasEqAsymmetric (LogType (MulType t t)) (AddType (LogType t) (LogType t)), HasEqAsymmetric (LogType (ExpType t)) t, CanTestCertainly (OrderCompareType t t), CanTestCertainly (OrderCompareType t Integer), CanTestCertainly (OrderCompareType (DivType Integer t) Integer), CanTestCertainly (OrderCompareType (MulType t t) Integer), CanTestCertainly (OrderCompareType (ExpType t) Integer), CanTestCertainly (EqCompareType (LogType (DivType Integer t)) (NegType (LogType t))), CanTestCertainly (EqCompareType (LogType (MulType t t)) (AddType (LogType t) (LogType t))), CanTestCertainly (EqCompareType (LogType (ExpType t)) t), Show t, Show (AddType (LogType t) (LogType t)), Show (NegType (LogType t)), Show (LogType (DivType Integer t)), Show (LogType (MulType t t)), Show (LogType (ExpType t)), CanLog t, CanLog (DivType Integer t), CanLog (MulType t t), CanLog (ExpType t), ConvertibleExactlyWithSample Integer t, CanNeg (LogType t)) => T t -> Spec
- powUsingExpLog :: (CanLogSameType t, CanExpSameType t, CanTestInteger t, CanTestZero t) => t -> (t -> t -> t) -> (t -> t) -> t -> t -> t
- class CanSinCos t where
- type SinCosType t
- cos :: t -> SinCosType t
- sin :: t -> SinCosType t
- type CanSinCosSameType t = (CanSinCos t, SinCosType t ~ t)
- specCanSinCosReal :: (Arbitrary t, CanPow (SinCosType t) Integer, CanSinCos t, CanSinCos (SubType t t), CanSub t t, CanSub (MulType (SinCosType t) (SinCosType t)) (MulType (SinCosType t) (SinCosType t)), CanMulAsymmetric (SinCosType t) (SinCosType t), HasEqAsymmetric (AddType (PowType (SinCosType t) Integer) (PowType (SinCosType t) Integer)) Integer, HasEqAsymmetric (SinCosType (SubType t t)) (SubType (MulType (SinCosType t) (SinCosType t)) (MulType (SinCosType t) (SinCosType t))), HasEqAsymmetric (SinCosType (SubType t t)) (AddType (MulType (SinCosType t) (SinCosType t)) (MulType (SinCosType t) (SinCosType t))), CanAddAsymmetric (PowType (SinCosType t) Integer) (PowType (SinCosType t) Integer), CanAddAsymmetric (MulType (SinCosType t) (SinCosType t)) (MulType (SinCosType t) (SinCosType t)), HasOrderAsymmetric t (DivType (SinCosType t) (SinCosType t)), HasOrderAsymmetric t Rational, HasOrderAsymmetric t Integer, HasOrderAsymmetric (SinCosType t) t, HasOrderAsymmetric (SinCosType t) Integer, HasOrderAsymmetric Integer (SinCosType t), CanTestCertainly (EqCompareType (AddType (PowType (SinCosType t) Integer) (PowType (SinCosType t) Integer)) Integer), CanTestCertainly (EqCompareType (SinCosType (SubType t t)) (SubType (MulType (SinCosType t) (SinCosType t)) (MulType (SinCosType t) (SinCosType t)))), CanTestCertainly (EqCompareType (SinCosType (SubType t t)) (AddType (MulType (SinCosType t) (SinCosType t)) (MulType (SinCosType t) (SinCosType t)))), CanTestCertainly (OrderCompareType t (DivType (SinCosType t) (SinCosType t))), CanTestCertainly (OrderCompareType t Rational), CanTestCertainly (OrderCompareType t Integer), CanTestCertainly (OrderCompareType (SinCosType t) t), CanTestCertainly (OrderCompareType (SinCosType t) Integer), CanTestCertainly (OrderCompareType Integer (SinCosType t)), Show t, Show (SubType (MulType (SinCosType t) (SinCosType t)) (MulType (SinCosType t) (SinCosType t))), Show (AddType (PowType (SinCosType t) Integer) (PowType (SinCosType t) Integer)), Show (AddType (MulType (SinCosType t) (SinCosType t)) (MulType (SinCosType t) (SinCosType t))), Show (DivType (SinCosType t) (SinCosType t)), Show (SinCosType t), Show (SinCosType (SubType t t)), CanDiv (SinCosType t) (SinCosType t)) => T t -> Spec
- approxPi :: Floating t => t
Square root
class CanSqrt t where Source #
A replacement for Prelude's sqrt
. If Floating t
,
then one can use the default implementation to mirror Prelude's sqrt
.
Minimal complete definition
Nothing
Methods
specCanSqrtReal :: (Arbitrary t, CanTestPosNeg t, HasOrderAsymmetric (SqrtType t) Integer, CanSqrt t, HasEqAsymmetric (PowType (SqrtType t) Integer) t, CanTestCertainly (OrderCompareType (SqrtType t) Integer), CanTestCertainly (EqCompareType (PowType (SqrtType t) Integer) t), Show t, Show (PowType (SqrtType t) Integer), Show (SqrtType t), CanPow (SqrtType t) Integer) => T t -> Spec Source #
HSpec properties that each implementation of CanSqrt should satisfy.
Exp
A replacement for Prelude's exp
. If Floating t
,
then one can use the default implementation to mirror Prelude's exp
.
Minimal complete definition
Nothing
Methods
specCanExpReal :: (SubType t t ~ t, SubType t Integer ~ t, SubType Integer t ~ t, AbsType t ~ t, AddType t t ~ t, AddType t Integer ~ t, AddType Integer t ~ t, DivIType t t ~ Integer, MulType t Integer ~ t, MulType Integer t ~ t, DivType t Integer ~ t, ModType t t ~ t, CanSub t t, CanSub t Integer, CanSub Integer t, Arbitrary t, CanAddAsymmetric t t, CanAddAsymmetric t Integer, CanAddAsymmetric Integer t, CanAbs t, CanDivIMod t t, HasOrderAsymmetric t t, HasOrderAsymmetric (ExpType t) Integer, CanExp t, CanExp (NegType t), CanDiv t Integer, CanDiv Integer (ExpType t), HasEqAsymmetric (ExpType t) (MulType (ExpType t) (ExpType t)), HasEqAsymmetric (ExpType (NegType t)) (DivType Integer (ExpType t)), CanTestCertainly (OrderCompareType t t), CanTestCertainly (OrderCompareType (ExpType t) Integer), CanTestCertainly (EqCompareType (ExpType t) (MulType (ExpType t) (ExpType t))), CanTestCertainly (EqCompareType (ExpType (NegType t)) (DivType Integer (ExpType t))), Show t, Show (DivType Integer (ExpType t)), Show (MulType (ExpType t) (ExpType t)), Show (ExpType t), Show (ExpType (NegType t)), CanMulAsymmetric t Integer, CanMulAsymmetric (ExpType t) (ExpType t), CanMulAsymmetric Integer t, ConvertibleExactlyWithSample Integer t, CanNeg t) => T t -> Spec Source #
HSpec properties that each implementation of CanExp should satisfy.
Log
A replacement for Prelude's log
. If Floating t
,
then one can use the default implementation to mirror Prelude's log
.
Minimal complete definition
Nothing
Methods
specCanLogReal :: (SubType t t ~ t, SubType t Integer ~ t, SubType Integer t ~ t, AbsType t ~ t, AddType t t ~ t, AddType t Integer ~ t, AddType Integer t ~ t, DivIType t t ~ Integer, MulType t Integer ~ t, MulType Integer t ~ t, DivType t Integer ~ t, ModType t t ~ t, CanSub t t, CanSub t Integer, CanSub Integer t, Arbitrary t, CanAbs t, CanDivIMod t t, CanDiv t Integer, CanDiv Integer t, CanMulAsymmetric t t, CanMulAsymmetric t Integer, CanMulAsymmetric Integer t, CanAddAsymmetric t t, CanAddAsymmetric t Integer, CanAddAsymmetric (LogType t) (LogType t), CanAddAsymmetric Integer t, CanExp t, HasOrderAsymmetric t t, HasOrderAsymmetric t Integer, HasOrderAsymmetric (DivType Integer t) Integer, HasOrderAsymmetric (MulType t t) Integer, HasOrderAsymmetric (ExpType t) Integer, HasEqAsymmetric (LogType (DivType Integer t)) (NegType (LogType t)), HasEqAsymmetric (LogType (MulType t t)) (AddType (LogType t) (LogType t)), HasEqAsymmetric (LogType (ExpType t)) t, CanTestCertainly (OrderCompareType t t), CanTestCertainly (OrderCompareType t Integer), CanTestCertainly (OrderCompareType (DivType Integer t) Integer), CanTestCertainly (OrderCompareType (MulType t t) Integer), CanTestCertainly (OrderCompareType (ExpType t) Integer), CanTestCertainly (EqCompareType (LogType (DivType Integer t)) (NegType (LogType t))), CanTestCertainly (EqCompareType (LogType (MulType t t)) (AddType (LogType t) (LogType t))), CanTestCertainly (EqCompareType (LogType (ExpType t)) t), Show t, Show (AddType (LogType t) (LogType t)), Show (NegType (LogType t)), Show (LogType (DivType Integer t)), Show (LogType (MulType t t)), Show (LogType (ExpType t)), CanLog t, CanLog (DivType Integer t), CanLog (MulType t t), CanLog (ExpType t), ConvertibleExactlyWithSample Integer t, CanNeg (LogType t)) => T t -> Spec Source #
HSpec properties that each implementation of CanLog should satisfy.
powUsingExpLog :: (CanLogSameType t, CanExpSameType t, CanTestInteger t, CanTestZero t) => t -> (t -> t -> t) -> (t -> t) -> t -> t -> t Source #
Sine and cosine
class CanSinCos t where Source #
A replacement for Prelude's cos
and sin
. If Floating t
,
then one can use the default implementation to mirror Prelude's sin
, cos
.
Minimal complete definition
Nothing
Methods
cos :: t -> SinCosType t Source #
default cos :: (SinCosType t ~ t, Floating t) => t -> SinCosType t Source #
sin :: t -> SinCosType t Source #
default sin :: (SinCosType t ~ t, Floating t) => t -> SinCosType t Source #
Instances
CanSinCos Double Source # | |||||
Defined in Numeric.MixedTypes.Elementary Associated Types
| |||||
CanSinCos a => CanSinCos (CN a) Source # | |||||
Defined in Numeric.MixedTypes.Elementary Associated Types
|
type CanSinCosSameType t = (CanSinCos t, SinCosType t ~ t) Source #
specCanSinCosReal :: (Arbitrary t, CanPow (SinCosType t) Integer, CanSinCos t, CanSinCos (SubType t t), CanSub t t, CanSub (MulType (SinCosType t) (SinCosType t)) (MulType (SinCosType t) (SinCosType t)), CanMulAsymmetric (SinCosType t) (SinCosType t), HasEqAsymmetric (AddType (PowType (SinCosType t) Integer) (PowType (SinCosType t) Integer)) Integer, HasEqAsymmetric (SinCosType (SubType t t)) (SubType (MulType (SinCosType t) (SinCosType t)) (MulType (SinCosType t) (SinCosType t))), HasEqAsymmetric (SinCosType (SubType t t)) (AddType (MulType (SinCosType t) (SinCosType t)) (MulType (SinCosType t) (SinCosType t))), CanAddAsymmetric (PowType (SinCosType t) Integer) (PowType (SinCosType t) Integer), CanAddAsymmetric (MulType (SinCosType t) (SinCosType t)) (MulType (SinCosType t) (SinCosType t)), HasOrderAsymmetric t (DivType (SinCosType t) (SinCosType t)), HasOrderAsymmetric t Rational, HasOrderAsymmetric t Integer, HasOrderAsymmetric (SinCosType t) t, HasOrderAsymmetric (SinCosType t) Integer, HasOrderAsymmetric Integer (SinCosType t), CanTestCertainly (EqCompareType (AddType (PowType (SinCosType t) Integer) (PowType (SinCosType t) Integer)) Integer), CanTestCertainly (EqCompareType (SinCosType (SubType t t)) (SubType (MulType (SinCosType t) (SinCosType t)) (MulType (SinCosType t) (SinCosType t)))), CanTestCertainly (EqCompareType (SinCosType (SubType t t)) (AddType (MulType (SinCosType t) (SinCosType t)) (MulType (SinCosType t) (SinCosType t)))), CanTestCertainly (OrderCompareType t (DivType (SinCosType t) (SinCosType t))), CanTestCertainly (OrderCompareType t Rational), CanTestCertainly (OrderCompareType t Integer), CanTestCertainly (OrderCompareType (SinCosType t) t), CanTestCertainly (OrderCompareType (SinCosType t) Integer), CanTestCertainly (OrderCompareType Integer (SinCosType t)), Show t, Show (SubType (MulType (SinCosType t) (SinCosType t)) (MulType (SinCosType t) (SinCosType t))), Show (AddType (PowType (SinCosType t) Integer) (PowType (SinCosType t) Integer)), Show (AddType (MulType (SinCosType t) (SinCosType t)) (MulType (SinCosType t) (SinCosType t))), Show (DivType (SinCosType t) (SinCosType t)), Show (SinCosType t), Show (SinCosType (SubType t t)), CanDiv (SinCosType t) (SinCosType t)) => T t -> Spec Source #
HSpec properties that each implementation of CanSinCos should satisfy.
Derived partially from http://math.stackexchange.com/questions/1303044/axiomatic-definition-of-sin-and-cos