Fraction class
A rational number.
- Implemented types
- Mixed-in types
- Annotations
-
- @immutable
Constructors
Properties
- a → int
-
Returns the numerator of the fraction.
final
- b → int
-
Returns the denominator of the fraction.
final
- denominator → int
-
Alternative way to access the denominator of the fraction.
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- isFinite → bool
-
Tests if this fraction is finite.
no setter
- isInfinite → bool
-
Tests if this fraction is infinite.
no setter
- isNaN → bool
-
Tests if this fraction is not defined.
no setter
- isNegative → bool
-
Tests if this fraction is negative.
no setter
- numerator → int
-
Alternative way to access the numerator of the fraction.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sign → int
-
Returns the sign of this fraction.
no setter
Methods
-
abs(
) → Fraction - Returns the absolute value of this fraction.
-
ceil(
) → int - Ceils this fraction to an integer.
-
closeTo(
Fraction other, num epsilon) → bool - Tests if this object is close to another object.
-
compareTo(
Fraction other) → int -
Compares this object to another object.
override
-
floor(
) → int - Floors this fraction to an integer.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pow(
int n) → Fraction - Returns the power of this fraction.
-
reciprocal(
) → Fraction - Returns the multiplicative inverse of this fraction.
-
round(
) → int - Rounds this fraction to an integer.
-
toDouble(
) → double - Converts this fraction to a double.
-
toInt(
) → int - Converts this fraction to an integer.
-
toString(
) → String -
A string representation of this object.
override
-
truncate(
) → int - Truncates this fraction to an integer.
Operators
-
operator *(
Object other) → Fraction -
Returns the multiplication of this fraction and
other
. -
operator +(
Object other) → Fraction -
Returns the sum of this fraction and
other
. -
operator -(
Object other) → Fraction -
Returns the difference of this fraction and
other
. -
operator /(
Object other) → Fraction -
Returns the division of this fraction and
other
. -
operator <(
Fraction other) → bool -
inherited
-
operator <=(
Fraction other) → bool -
inherited
-
operator ==(
Object other) → bool -
The equality operator.
override
-
operator >(
Fraction other) → bool -
inherited
-
operator >=(
Fraction other) → bool -
inherited
-
operator unary-(
) → Fraction - Returns the negation of this fraction.
Static Properties
Static Methods
Constants
- infinity → const Fraction
- The infinite fraction.
- nan → const Fraction
- The fraction that is not a number.
- negativeInfinity → const Fraction
- The negative infinite fraction.
- one → const Fraction
-
The neutral multiplicative element, that is
1
. - zero → const Fraction
-
The neutral additive element, that is
0
.