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 long
doubleHash
(double value) A portable way to hash a double value.(package private) static String
formatDouble
(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 String
formatString
(String format, Object... params) ReturnsString.format
with the arguments.(package private) static int
getExponent
(double d) (package private) static Logger
getLoggerForClass
(Class<?> clazz) Returns theLogger
for the class.(package private) static double
IEEEremainder
(double f1, double f2) (package private) static BigDecimal
newBigDecimal
(double x) Returns a newBigDecimal
instance whose value is the exact decimal representation ofx
, emulating the behavior ofBigDecimal(double)
.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)
.(package private) static void
printf
(PrintStream stream, String format, Object... params) Invokesstream.printf
with the arguments.static int
Returns the sign of the determinant of the matrix constructed from the three column vectorsa
,b
, andc
.static double
ulp
(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 theLogger
for the class.- See Also:
-
printf
Invokesstream.printf
with 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.format
with 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 newBigDecimal
instance whose value is the exact decimal representation ofx
, emulating the behavior ofBigDecimal(double)
.
-