|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | ||||||||
java.lang.Objectjava.lang.Enum<DivisionMode>
com.github.kiprobinson.bigfraction.DivisionMode
public enum DivisionMode
Representation of methods of performing Euclidean division--dividing to an integer and obtaining
a remainder. The division methods are all the same when dividend and divisor are positive, but they
differ when one or both values are negative.
Given the division problem a/b, all methods produce integer quotient q and remainder r, with 0 <= r < b,
fulfilling the equations:
a/b = q + r/b
a = b*q + r
r = a - b*q
More information available at https://en.wikipedia.org/wiki/Modulo_operation.
| Enum Constant Summary | |
|---|---|
EUCLIDEAN
Euclidean division chooses a quotient which will ensure that the remainder is always positive. |
|
FLOORED
In floored division, the quotient is floored (rounded toward negative infinity). |
|
TRUNCATED
In truncated division, the quotient is truncated (rounded toward zero). |
|
| Method Summary | |
|---|---|
static DivisionMode |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static DivisionMode[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
| Methods inherited from class java.lang.Enum |
|---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Enum Constant Detail |
|---|
public static final DivisionMode TRUNCATED
q = trunc(a/b) (round toward zero)r = a - b*q
public static final DivisionMode FLOORED
q = floor(a/b) (round toward negative infinity)r = a - b*q
public static final DivisionMode EUCLIDEAN
q = sign(b) * floor(a/abs(b))b > 0: q = floor(a/b)b < 0: q = ciel(a/b)r = a - b*q
| Method Detail |
|---|
public static DivisionMode[] values()
for (DivisionMode c : DivisionMode.values()) System.out.println(c);
public static DivisionMode valueOf(String name)
name - the name of the enum constant to be returned.
IllegalArgumentException - if this enum type has no constant
with the specified name
NullPointerException - if the argument is null
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | ||||||||