Class ExactMath
java.lang.Object
com.oracle.truffle.api.ExactMath
This class contains exact math related methods that are generally useful for dynamic language
implementations.
- Since:
- 0.8 or earlier
-
Method Summary
Modifier and TypeMethodDescriptionstatic intmultiplyHigh(int x, int y) static longmultiplyHigh(long x, long y) static intmultiplyHighUnsigned(int x, int y) static longmultiplyHighUnsigned(long x, long y) static doubletruncate(double x) Removes the decimal part (aka truncation or rounds towards zero) of the given double.static floattruncate(float x) Removes the decimal part (aka truncation or rounds towards zero) of the given float.
-
Method Details
-
multiplyHigh
public static int multiplyHigh(int x, int y) - Since:
- 0.8 or earlier
-
multiplyHighUnsigned
public static int multiplyHighUnsigned(int x, int y) - Since:
- 0.8 or earlier
-
multiplyHigh
public static long multiplyHigh(long x, long y) - Since:
- 0.8 or earlier
-
multiplyHighUnsigned
public static long multiplyHighUnsigned(long x, long y) - Since:
- 0.8 or earlier
-
truncate
public static float truncate(float x) Removes the decimal part (aka truncation or rounds towards zero) of the given float.This corresponds to the IEEE 754
roundToIntegralTowardZerooperation (IEEE Std 754-2008, section 5.9, page 41).- Since:
- 21.1
-
truncate
public static double truncate(double x) Removes the decimal part (aka truncation or rounds towards zero) of the given double.This corresponds to the IEEE 754
roundToIntegralTowardZerooperation (IEEE Std 754-2008, section 5.9, page 41).- Since:
- 21.1
-