Package com.google.common.geometry
Class Platform
java.lang.Object
com.google.common.geometry.Platform
Contains utility methods which require different GWT client and server implementations. This
contains the server side implementations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longdoubleHash(double value) A portable way to hash a double value.(package private) static StringformatDouble(double d) Formats the double as a string and removes unneeded trailing zeros, to behave the same as printf("%.15g",d) in C++.(package private) static StringformatString(String format, Object... params) ReturnsString.formatwith the arguments.(package private) static intgetExponent(double d) (package private) static LoggergetLoggerForClass(Class<?> clazz) Returns theLoggerfor the class.(package private) static doubleIEEEremainder(double f1, double f2) (package private) static BigDecimalnewBigDecimal(double x) Returns a newBigDecimalinstance whose value is the exact decimal representation ofx, emulating the behavior ofBigDecimal(double).static doublenextAfter(double x, double dir) Returns the next representable value in the direction of 'dir' starting from 'x', emulating the behavior ofMath.nextAfter(double, double).(package private) static voidprintf(PrintStream stream, String format, Object... params) Invokesstream.printfwith the arguments.static intReturns the sign of the determinant of the matrix constructed from the three column vectorsa,b, andc.static doubleulp(double x) Returns the size of an ulp of the argument.
-
Constructor Details
-
Platform
private Platform()
-
-
Method Details
-
IEEEremainder
static double IEEEremainder(double f1, double f2) - See Also:
-
getExponent
static int getExponent(double d) - See Also:
-
getLoggerForClass
Returns theLoggerfor the class.- See Also:
-
printf
Invokesstream.printfwith the arguments. The GWT client just prints the format string and the arguments separately. Using this method is not recommended; you should instead construct strings with normal string concatenation whenever possible, so it will work the same way in normal Java and GWT client versions. -
formatString
ReturnsString.formatwith the arguments. The GWT client just returns a string consisting of the format string with the parameters concatenated to the end of it. Using this method is not recommended; you should instead construct strings with normal string concatenation whenever possible, so it will work the same way in normal Java and GWT client versions. -
formatDouble
Formats the double as a string and removes unneeded trailing zeros, to behave the same as printf("%.15g",d) in C++. The Javascript implementation does NOT have identical behavior. -
doubleHash
public static long doubleHash(double value) A portable way to hash a double value. -
sign
Returns the sign of the determinant of the matrix constructed from the three column vectorsa,b, andc. This operation is very robust for small determinants, but is extremely slow and should only be used if performance is not a concern or all faster techniques have been exhausted. -
ulp
public static double ulp(double x) Returns the size of an ulp of the argument. An ulp of a double value is the positive distance between this floating-point value and the double next larger in magnitude. -
nextAfter
public static double nextAfter(double x, double dir) Returns the next representable value in the direction of 'dir' starting from 'x', emulating the behavior ofMath.nextAfter(double, double). -
newBigDecimal
Returns a newBigDecimalinstance whose value is the exact decimal representation ofx, emulating the behavior ofBigDecimal(double).
-