Package com.google.common.math
Class ToDoubleRounder<X extends Number & Comparable<X>>
java.lang.Object
com.google.common.math.ToDoubleRounder<X>
- Direct Known Subclasses:
BigDecimalMath.BigDecimalToDoubleRounder
,BigIntegerMath.BigIntegerToDoubleRounder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) abstract X
Returns a - b, guaranteed that both arguments are nonnegative.(package private) final double
roundToDouble
(X x, RoundingMode mode) Roundsx
to adouble
.(package private) abstract double
Returns x rounded to either the greatest double less than or equal to the precise value of x, or the least double greater than or equal to the precise value of x.(package private) abstract int
Returns the sign of x: either -1, 0, or 1.(package private) abstract X
toX
(double d, RoundingMode mode) Returns d's value as an X, rounded with the specified mode.
-
Constructor Details
-
ToDoubleRounder
ToDoubleRounder()
-
-
Method Details
-
roundToDoubleArbitrarily
Returns x rounded to either the greatest double less than or equal to the precise value of x, or the least double greater than or equal to the precise value of x. -
sign
Returns the sign of x: either -1, 0, or 1. -
toX
Returns d's value as an X, rounded with the specified mode. -
minus
Returns a - b, guaranteed that both arguments are nonnegative. -
roundToDouble
Roundsx
to adouble
.
-