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]
@[simp]
theorem
round_natCast
{α : Type u_2}
[Ring α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
(n : ℕ)
:
@[simp]
theorem
round_ofNat
{α : Type u_2}
[Ring α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
(n : ℕ)
[n.AtLeastTwo]
:
@[simp]
theorem
round_intCast
{α : Type u_2}
[Ring α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
(n : ℤ)
:
@[simp]
theorem
round_add_intCast
{α : Type u_2}
[Ring α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
(x : α)
(y : ℤ)
:
@[deprecated round_add_intCast (since := "2025-03-23")]
theorem
round_add_int
{α : Type u_2}
[Ring α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
(x : α)
(y : ℤ)
:
Alias of round_add_intCast
.
@[simp]
theorem
round_add_one
{α : Type u_2}
[Ring α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
(a : α)
:
@[simp]
theorem
round_sub_intCast
{α : Type u_2}
[Ring α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
(x : α)
(y : ℤ)
:
@[deprecated round_sub_intCast (since := "2025-03-23")]
theorem
round_sub_int
{α : Type u_2}
[Ring α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
(x : α)
(y : ℤ)
:
Alias of round_sub_intCast
.
@[simp]
theorem
round_sub_one
{α : Type u_2}
[Ring α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
(a : α)
:
@[simp]
theorem
round_add_natCast
{α : Type u_2}
[Ring α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
(x : α)
(y : ℕ)
:
@[deprecated round_add_natCast (since := "2025-03-23")]
theorem
round_add_nat
{α : Type u_2}
[Ring α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
(x : α)
(y : ℕ)
:
Alias of round_add_natCast
.
@[simp]
theorem
round_add_ofNat
{α : Type u_2}
[Ring α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
(x : α)
(n : ℕ)
[n.AtLeastTwo]
:
@[simp]
theorem
round_sub_natCast
{α : Type u_2}
[Ring α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
(x : α)
(y : ℕ)
:
@[deprecated round_sub_natCast (since := "2025-03-23")]
theorem
round_sub_nat
{α : Type u_2}
[Ring α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
(x : α)
(y : ℕ)
:
Alias of round_sub_natCast
.
@[simp]
theorem
round_sub_ofNat
{α : Type u_2}
[Ring α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
(x : α)
(n : ℕ)
[n.AtLeastTwo]
:
@[simp]
theorem
round_intCast_add
{α : Type u_2}
[Ring α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
(x : α)
(y : ℤ)
:
@[deprecated round_intCast_add (since := "2025-03-23")]
theorem
round_int_add
{α : Type u_2}
[Ring α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
(x : α)
(y : ℤ)
:
Alias of round_intCast_add
.
@[simp]
theorem
round_natCast_add
{α : Type u_2}
[Ring α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
(x : α)
(y : ℕ)
:
@[deprecated round_natCast_add (since := "2025-03-23")]
theorem
round_nat_add
{α : Type u_2}
[Ring α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
(x : α)
(y : ℕ)
:
Alias of round_natCast_add
.
@[simp]
theorem
round_ofNat_add
{α : Type u_2}
[Ring α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
(n : ℕ)
[n.AtLeastTwo]
(x : α)
:
@[simp]
theorem
round_two_inv
{α : Type u_2}
[Field α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
:
@[simp]
theorem
round_neg_two_inv
{α : Type u_2}
[Field α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
:
@[simp]
theorem
round_eq_zero_iff
{α : Type u_2}
[Field α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
{x : α}
:
theorem
abs_sub_round
{α : Type u_2}
[Field α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
(x : α)
:
theorem
sub_half_lt_round
{α : Type u_2}
[Field α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
(x : α)
:
theorem
round_le_add_half
{α : Type u_2}
[Field α]
[LinearOrder α]
[IsStrictOrderedRing α]
[FloorRing α]
(x : α)
:
theorem
Int.map_round
{F : Type u_1}
{α : Type u_2}
{β : Type u_3}
[Field α]
[LinearOrder α]
[IsStrictOrderedRing α]
[Field β]
[LinearOrder β]
[IsStrictOrderedRing β]
[FloorRing α]
[FloorRing β]
[FunLike F α β]
[RingHomClass F α β]
(f : F)
(hf : StrictMono ⇑f)
(a : α)
: