Top Description Constructors Methods
com.google.common.math

pack-priv abstract Class ToDoubleRounder<X extends Number & Comparable<X>>

extends Object
Class Inheritance
Known Direct Subclasses
com.google.common.math.BigDecimalMath.BigDecimalToDoubleRounder, com.google.common.math.BigIntegerMath.BigIntegerToDoubleRounder
Annotations
@GwtIncompatible
@ElementTypesAreNonnullByDefault
Static Imports
com.google.common.base.Preconditions.checkNotNull, com.google.common.math.MathPreconditions.checkRoundingUnnecessary

Helper type to implement rounding X to a representable double value according to a RoundingMode.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract X
minus(X a, X b)

Returns a - b, guaranteed that both arguments are nonnegative.

pack-priv final double
roundToDouble(X x, RoundingMode mode)

Rounds x to a double.

pack-priv 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.

pack-priv abstract int
sign(X x)

Returns the sign of x: either -1, 0, or 1.

pack-priv abstract X
toX(double d, RoundingMode mode)

Returns d's value as an X, rounded with the specified mode.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ToDoubleRounderback to summary
pack-priv ToDoubleRounder()

Method Detail

minusback to summary
pack-priv abstract X minus(X a, X b)

Returns a - b, guaranteed that both arguments are nonnegative.

roundToDoubleback to summary
pack-priv final double roundToDouble(X x, RoundingMode mode)

Rounds x to a double.

roundToDoubleArbitrarilyback to summary
pack-priv 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.

signback to summary
pack-priv abstract int sign(X x)

Returns the sign of x: either -1, 0, or 1.

toXback to summary
pack-priv abstract X toX(double d, RoundingMode mode)

Returns d's value as an X, rounded with the specified mode.