Package com.oracle.truffle.api
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 int
multiplyHigh
(int x, int y) static long
multiplyHigh
(long x, long y) static int
multiplyHighUnsigned
(int x, int y) static long
multiplyHighUnsigned
(long x, long y) static double
truncate
(double x) Removes the decimal part (aka truncation or rounds towards zero) of the given double.static float
truncate
(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
roundToIntegralTowardZero
operation (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
roundToIntegralTowardZero
operation (IEEE Std 754-2008, section 5.9, page 41).- Since:
- 21.1
-