Rounding #
This file defines the round
function, which uses the floor
or ceil
function to round a number
to the nearest integer.
Main Definitions #
round a
: Nearest integer toa
. It rounds halves towards infinity.
Tags #
rounding
Round #
@[simp]
@[simp]
theorem
round_ofNat
{α : Type u_2}
[LinearOrderedRing α]
[FloorRing α]
(n : ℕ)
[n.AtLeastTwo]
:
round (OfNat.ofNat n) = OfNat.ofNat n
@[simp]
@[simp]
@[simp]
@[simp]
theorem
round_add_ofNat
{α : Type u_2}
[LinearOrderedRing α]
[FloorRing α]
(x : α)
(n : ℕ)
[n.AtLeastTwo]
:
round (x + OfNat.ofNat n) = round x + OfNat.ofNat n
@[simp]
theorem
round_sub_ofNat
{α : Type u_2}
[LinearOrderedRing α]
[FloorRing α]
(x : α)
(n : ℕ)
[n.AtLeastTwo]
:
round (x - OfNat.ofNat n) = round x - OfNat.ofNat n
@[simp]
theorem
round_ofNat_add
{α : Type u_2}
[LinearOrderedRing α]
[FloorRing α]
(n : ℕ)
[n.AtLeastTwo]
(x : α)
:
round (OfNat.ofNat n + x) = OfNat.ofNat n + round x
@[simp]
@[simp]
theorem
Int.map_round
{F : Type u_1}
{α : Type u_2}
{β : Type u_3}
[LinearOrderedField α]
[LinearOrderedField β]
[FloorRing α]
[FloorRing β]
[FunLike F α β]
[RingHomClass F α β]
(f : F)
(hf : StrictMono ⇑f)
(a : α)
: