{-# OPTIONS_GHC -Wno-orphans #-}
module AERN2.MP.Float.Arithmetic
(
addCEDU, subCEDU
, mulCEDU, divCEDU, recipCEDU
, piCEDU
, cosCEDU, sinCEDU
, sqrtCEDU, expCEDU, logCEDU
)
where
import MixedTypesNumPrelude
import qualified Prelude as P
import AERN2.MP.Precision
import qualified Data.CDAR as MPLow
import AERN2.MP.Float.Auxi
import AERN2.MP.Float.Type
instance CanNeg MPFloat where
negate :: MPFloat -> NegType MPFloat
negate = MPFloat -> NegType MPFloat
forall a. Num a => a -> a
P.negate
instance CanAbs MPFloat where
abs :: MPFloat -> AbsType MPFloat
abs = MPFloat -> AbsType MPFloat
forall a. Num a => a -> a
P.abs
addCEDU :: MPFloat -> MPFloat -> BoundsCEDU MPFloat
addCEDU :: MPFloat -> MPFloat -> BoundsCEDU MPFloat
addCEDU = (MPFloat -> MPFloat -> MPFloat)
-> MPFloat -> MPFloat -> BoundsCEDU MPFloat
binaryCEDU MPFloat -> MPFloat -> MPFloat
forall a. Num a => a -> a -> a
(P.+)
subCEDU :: MPFloat -> MPFloat -> BoundsCEDU MPFloat
subCEDU :: MPFloat -> MPFloat -> BoundsCEDU MPFloat
subCEDU = (MPFloat -> MPFloat -> MPFloat)
-> MPFloat -> MPFloat -> BoundsCEDU MPFloat
binaryCEDU MPFloat -> MPFloat -> MPFloat
forall a. Num a => a -> a -> a
(P.-)
mulCEDU :: MPFloat -> MPFloat -> BoundsCEDU MPFloat
mulCEDU :: MPFloat -> MPFloat -> BoundsCEDU MPFloat
mulCEDU = (MPFloat -> MPFloat -> MPFloat)
-> MPFloat -> MPFloat -> BoundsCEDU MPFloat
binaryCEDU MPFloat -> MPFloat -> MPFloat
forall a. Num a => a -> a -> a
(P.*)
divCEDU :: MPFloat -> MPFloat -> BoundsCEDU MPFloat
divCEDU :: MPFloat -> MPFloat -> BoundsCEDU MPFloat
divCEDU MPFloat
x MPFloat
y
| MPFloat
y MPFloat -> MPFloat -> Bool
forall a. Eq a => a -> a -> Bool
P.== (Integer -> MPFloat
forall a. Num a => Integer -> a
P.fromInteger Integer
0) = MPFloat -> BoundsCEDU MPFloat
getBoundsCEDU MPFloat
MPLow.Bottom
| Bool
otherwise = (MPFloat -> MPFloat -> MPFloat)
-> MPFloat -> MPFloat -> BoundsCEDU MPFloat
binaryCEDU MPFloat -> MPFloat -> MPFloat
forall a. Fractional a => a -> a -> a
(P./) MPFloat
x MPFloat
y
recipCEDU :: MPFloat -> BoundsCEDU MPFloat
recipCEDU :: MPFloat -> BoundsCEDU MPFloat
recipCEDU = (MPFloat -> MPFloat) -> MPFloat -> BoundsCEDU MPFloat
unaryCEDU MPFloat -> MPFloat
forall a. Fractional a => a -> a
P.recip
piCEDU :: Precision -> BoundsCEDU MPFloat
piCEDU :: Precision -> BoundsCEDU MPFloat
piCEDU Precision
pp =
MPFloat -> BoundsCEDU MPFloat
getBoundsCEDU (MPFloat -> BoundsCEDU MPFloat) -> MPFloat -> BoundsCEDU MPFloat
forall a b. (a -> b) -> a -> b
$ Precision -> MPFloat
MPLow.piA (Precision -> Precision
p2cdarPrec Precision
pp)
cosCEDU :: MPFloat -> BoundsCEDU MPFloat
cosCEDU :: MPFloat -> BoundsCEDU MPFloat
cosCEDU = (MPFloat -> MPFloat) -> MPFloat -> BoundsCEDU MPFloat
unaryCEDU MPFloat -> MPFloat
MPLow.cosA
sinCEDU :: MPFloat -> BoundsCEDU MPFloat
sinCEDU :: MPFloat -> BoundsCEDU MPFloat
sinCEDU = (MPFloat -> MPFloat) -> MPFloat -> BoundsCEDU MPFloat
unaryCEDU MPFloat -> MPFloat
MPLow.sinA
sqrtCEDU :: MPFloat -> BoundsCEDU MPFloat
sqrtCEDU :: MPFloat -> BoundsCEDU MPFloat
sqrtCEDU = (MPFloat -> MPFloat) -> MPFloat -> BoundsCEDU MPFloat
unaryCEDU MPFloat -> MPFloat
MPLow.sqrtA
expCEDU :: MPFloat -> BoundsCEDU MPFloat
expCEDU :: MPFloat -> BoundsCEDU MPFloat
expCEDU = (MPFloat -> MPFloat) -> MPFloat -> BoundsCEDU MPFloat
unaryCEDU MPFloat -> MPFloat
MPLow.expA
logCEDU :: MPFloat -> BoundsCEDU MPFloat
logCEDU :: MPFloat -> BoundsCEDU MPFloat
logCEDU = (MPFloat -> MPFloat) -> MPFloat -> BoundsCEDU MPFloat
unaryCEDU MPFloat -> MPFloat
MPLow.logA
binaryCEDU ::
(MPFloat -> MPFloat -> MPFloat) ->
(MPFloat -> MPFloat -> BoundsCEDU MPFloat)
binaryCEDU :: (MPFloat -> MPFloat -> MPFloat)
-> MPFloat -> MPFloat -> BoundsCEDU MPFloat
binaryCEDU MPFloat -> MPFloat -> MPFloat
op MPFloat
x MPFloat
y =
MPFloat -> BoundsCEDU MPFloat
getBoundsCEDU (MPFloat -> BoundsCEDU MPFloat) -> MPFloat -> BoundsCEDU MPFloat
forall a b. (a -> b) -> a -> b
$ MPFloat -> MPFloat -> MPFloat
op MPFloat
x MPFloat
y
unaryCEDU ::
(MPFloat -> MPFloat) ->
(MPFloat -> BoundsCEDU MPFloat)
unaryCEDU :: (MPFloat -> MPFloat) -> MPFloat -> BoundsCEDU MPFloat
unaryCEDU MPFloat -> MPFloat
op MPFloat
x =
MPFloat -> BoundsCEDU MPFloat
getBoundsCEDU (MPFloat -> BoundsCEDU MPFloat) -> MPFloat -> BoundsCEDU MPFloat
forall a b. (a -> b) -> a -> b
$ MPFloat -> MPFloat
op MPFloat
x