Convert.finish is valid`
Convert.finish is correct
theorem
Floating.approx_convert
{a : ℝ}
{n : ℕ}
{s : ℤ}
{norm : n ∈ Set.Icc (2 ^ 62) (2 ^ 63)}
{up : Bool}
(an : if up = true then a ≤ ↑n * 2 ^ (s - 2 ^ 63) else ↑n * 2 ^ (s - 2 ^ 63) ≤ a)
:
Rounds ((convert_tweak n s norm).finish up) a up
Prove a (convert_tweak _ _ _).finish _ call is correct, in context.
Conversion from ℕ #
Conversion from ℕ literals to Floating, rounding down arbitrarily.
Use Interval.ofNat if you want something trustworthy (it rounds both ways).
Equations
- Floating.instOfNatOfAtLeastTwo = { ofNat := Floating.ofNat n false }
Small naturals convert exactly
Conversion from ℤ #
@[irreducible]
Conversion from ℤ
Equations
- Floating.ofInt n up = bif decide (n < 0) then -Floating.ofNat (-n).toNat !up else Floating.ofNat n.toNat up
Instances For
Conversion from ℚ #
@[irreducible, inline]
Conversion from ℚ, taking absolute values and rounding up or down
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[irreducible]
Conversion from ℚ, rounding up or down
Equations
- Floating.ofRat x up = bif decide (x < 0) then -Floating.ofRat_abs x (up != decide (x < 0)) else Floating.ofRat_abs x (up != decide (x < 0))