RoundingMode enum
Rounding modes for decimal operations
Values
- up → const RoundingMode
-
Upward rounding (away from zero) Examples for integers:
- -2.3 -> -3
- 2.3 -> 3
- 0.0 -> 0
- 0.0000001 -> 1
- -0.0000001 -> -1
- down → const RoundingMode
-
Downward rounding (towards zero) Examples for integers:
- -2.3 -> -2
- 2.3 -> 2
- 0.0 -> 0
- 0.0000001 -> 0
- -0.0000001 -> 0
- ceiling → const RoundingMode
-
Ceiling rounding (towards positive infinity) Examples for integers:
- -2.3 -> -2
- 2.3 -> 3
- 0.0 -> 0
- 0.0000001 -> 1
- -0.0000001 -> 0
- floor → const RoundingMode
-
Floor rounding (towards negative infinity) Examples for integers:
- -2.3 -> -3
- 2.3 -> 2
- 0.0 -> 0
- 0.0000001 -> 0
- -0.0000001 -> -1
- halfUp → const RoundingMode
-
Five up six down (round towards nearest integer, if equidistant round up) Examples for integers:
- -2.5 -> -3
- 2.5 -> 3
- -2.4 -> -2
- 2.4 -> 2
- 0.5 -> 1
- -0.5 -> -1
- halfDown → const RoundingMode
-
Five down six up (round towards nearest integer, if equidistant round down) Examples for integers:
- -2.5 -> -2
- 2.5 -> 2
- -2.6 -> -3
- 2.6 -> 3
- 0.5 -> 0
- -0.5 -> 0
- halfEven → const RoundingMode
-
Five to even (round towards nearest integer, if equidistant round to even) Examples for integers:
- -2.5 -> -2
- 2.5 -> 2
- -3.5 -> -4
- 3.5 -> 4
- -2.6 -> -3
- 2.6 -> 3
- 0.5 -> 0
- 1.5 -> 2
- unnecessary → const RoundingMode
-
Assert that no rounding is necessary Examples for integers:
- -2.0 -> -2
- 2.0 -> 2
- -2.3 -> throws ArgumentError
- 2.3 -> throws ArgumentError
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
values
→ const List<
RoundingMode> - A constant List of the values in this enum, in order of their declaration.