java.lang.Object
com.github.stephengold.joltjni.std.Std
Java equivalents for (and access to) certain features of the
std::
namespace.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PrintStream
standard error stream (to expedite translation of C++ code)static final PrintStream
standard output stream (to expedite translation of C++ code)static final String
line separator (to expedite translation of C++ code)static final float
difference between 1 and the smallest float greater than 1static final float
largest finite value of typefloat
static final int
largest value of typeint
-
Method Summary
Modifier and TypeMethodDescriptionstatic float
exp
(float value) Return the exponential of the specified single-precision value.static float
fmod
(float numerator, float denominator) Return the remainder whennumerator
is divided bydenominator
.static float
hypot
(float opposite, float adjacent) Return the hypotenuse of the specified right triangle.static float
pow
(float base, float exponent) Return the specified power of the specified single-precision base.static void
shuffle
(int[] indices, DefaultRandomEngine generator) Shuffle the specified array.static void
shuffle
(List<Object> list, DefaultRandomEngine generator) Shuffle the specified Java list.static int
Count the number of elements in the specified array.static float
sqrt
(float value) Return the square root of the specified single-precision value.static int
Compare the specified strings lexicographically.
-
Field Details
-
FLT_EPSILON
public static final float FLT_EPSILONdifference between 1 and the smallest float greater than 1- See Also:
-
FLT_MAX
public static final float FLT_MAXlargest finite value of typefloat
- See Also:
-
INT_MAX
public static final int INT_MAXlargest value of typeint
- See Also:
-
cerr
standard error stream (to expedite translation of C++ code) -
cout
standard output stream (to expedite translation of C++ code) -
endl
line separator (to expedite translation of C++ code)
-
-
Method Details
-
exp
public static float exp(float value) Return the exponential of the specified single-precision value. There's evidence this is faster thanMath.exp(double)
.- Parameters:
value
- the input exponent- Returns:
- the exponential
-
fmod
public static float fmod(float numerator, float denominator) Return the remainder whennumerator
is divided bydenominator
.- Parameters:
numerator
- the numeratordenominator
- the denominator- Returns:
- the remainder (with the same sign as
numerator
)
-
hypot
public static float hypot(float opposite, float adjacent) Return the hypotenuse of the specified right triangle.- Parameters:
opposite
- the signed length of the opposite sideadjacent
- the signed length of the adjacent side- Returns:
- the length of the hypotenuse (≥0)
-
pow
public static float pow(float base, float exponent) Return the specified power of the specified single-precision base. There's evidence this is faster thanMath.pow(double, double)
.- Parameters:
base
- the base valueexponent
- the exponent value- Returns:
- the power value
-
shuffle
Shuffle the specified array.- Parameters:
indices
- the values to shuffle (not null, modified)generator
- the sequence generator to use (not null, modified)
-
shuffle
Shuffle the specified Java list.- Parameters:
list
- the list to shuffle (not null, modified)generator
- the sequence generator to use (not null, modified)
-
size
Count the number of elements in the specified array.- Parameters:
array
- the array to measure (not null, unaffected)- Returns:
- the number of elements (≥0)
-
sqrt
public static float sqrt(float value) Return the square root of the specified single-precision value. There's evidence this is slower thanMath.sqrt(double)
.- Parameters:
value
- the input value- Returns:
- the square root
-
strcmp
Compare the specified strings lexicographically.- Parameters:
lhs
- the first string to compare (not null)rhs
- the 2nd string to compare (not null)- Returns:
- a negative value if
lhs
precedesrhs
in lexicographical order, or greater than zero iflhs
followsrhs
, or zero if they are equal
-