Implementation of floating-point numbers (experimental). #
Equations
- Int.shift2 a b x = match x with | Int.ofNat e => (a <<< e, b) | Int.negSucc e => (a, b <<< e.succ)
Instances For
Equations
- FP.instInhabitedRMode = { default := FP.RMode.NE }
Equations
- FP.decValidFinite e m = id inferInstance
- inf: [C : FP.FloatCfg] → Bool → FP.Float
- nan: [C : FP.FloatCfg] → FP.Float
- finite: [C : FP.FloatCfg] → Bool → (e : ℤ) → (m : ℕ) → FP.ValidFinite e m → FP.Float
Instances For
Equations
- x.isFinite = match x with | FP.Float.finite a e m a_1 => true | x => false
Instances For
Equations
- FP.toRat x✝ x = match x✝, x with | FP.Float.finite s e m a, x => match Int.shift2 m 1 e with | (n, d) => let r := mkRat (↑n) d; if s = true then -r else r
Instances For
Equations
- FP.Float.zero s = FP.Float.finite s FP.emin 0 ⋯
Instances For
Equations
- FP.instInhabitedFloat = { default := FP.Float.zero true }
Equations
- x.sign' = match x with | FP.Float.inf s => pure s | FP.Float.nan => ⊤ | FP.Float.finite s e m a => pure s
Instances For
Equations
- x.sign = match x with | FP.Float.inf s => s | FP.Float.nan => false | FP.Float.finite s e m a => s
Instances For
Equations
- x.isZero = match x with | FP.Float.finite a e 0 a_1 => true | x => false
Instances For
Equations
- x.neg = match x with | FP.Float.inf s => FP.Float.inf !s | FP.Float.nan => FP.Float.nan | FP.Float.finite s e m f => FP.Float.finite (!s) e m f
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- FP.nextUpPos e m v = let m' := m.succ; if ss : m'.size = m.size then FP.Float.finite false e m' ⋯ else if h : e = ↑FP.emax then FP.Float.inf false else FP.Float.finite false e.succ m'.div2 ⋯
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- FP.nextUp x = match x with | FP.Float.finite false e m f => FP.nextUpPos e m f | FP.Float.finite true e m f => (FP.nextDnPos e m f).neg | f => f
Instances For
Equations
- FP.nextDn x = match x with | FP.Float.finite false e m f => FP.nextDnPos e m f | FP.Float.finite true e m f => (FP.nextUpPos e m f).neg | f => f
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- FP.ofRatDn r = (FP.ofRatUp (-r)).neg
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- FP.Float.instNeg = { neg := FP.Float.neg }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- FP.Float.instAdd = { add := FP.Float.add FP.RMode.NE }
unsafe def
FP.Float.sub
[C : FP.FloatCfg]
(mode : FP.RMode)
(f1 : FP.Float)
(f2 : FP.Float)
:
FP.Float
Equations
- FP.Float.sub mode f1 f2 = FP.Float.add mode f1 (-f2)
Instances For
Equations
- FP.Float.instSub = { sub := FP.Float.sub FP.RMode.NE }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.