Package com.google.common.math
Class ToDoubleRounder<X extends java.lang.Number & java.lang.Comparable<X>>
- java.lang.Object
-
- com.google.common.math.ToDoubleRounder<X>
-
- Direct Known Subclasses:
BigDecimalMath.BigDecimalToDoubleRounder,BigIntegerMath.BigIntegerToDoubleRounder
abstract class ToDoubleRounder<X extends java.lang.Number & java.lang.Comparable<X>> extends java.lang.ObjectHelper type to implement roundingXto a representabledoublevalue according to aRoundingMode.
-
-
Constructor Summary
Constructors Constructor Description ToDoubleRounder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) abstract Xminus(X a, X b)Returns a - b, guaranteed that both arguments are nonnegative.(package private) doubleroundToDouble(X x, java.math.RoundingMode mode)Roundsxto adouble.(package private) abstract doubleroundToDoubleArbitrarily(X x)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 intsign(X x)Returns the sign of x: either -1, 0, or 1.(package private) abstract XtoX(double d, java.math.RoundingMode mode)Returns d's value as an X, rounded with the specified mode.
-
-
-
Method Detail
-
roundToDoubleArbitrarily
abstract double roundToDoubleArbitrarily(X x)
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
abstract int sign(X x)
Returns the sign of x: either -1, 0, or 1.
-
toX
abstract X toX(double d, java.math.RoundingMode mode)
Returns d's value as an X, rounded with the specified mode.
-
roundToDouble
final double roundToDouble(X x, java.math.RoundingMode mode)
Roundsxto adouble.
-
-