In the java Math class, the outputs of some methods are described as "semi monotonic".
for example:
/**
Returns the base 10 logarithm of a {@code double} value.
...
Results must be semi-monotonic.
*/
public static double log10(double a) {
return StrictMath.log10(a);
}
I'm familiar with monotonic functions, but what does this mean?
@mrp directs us to the Math library documentation on this java-specific term, which explains that semi-monotonic is a notion describing how certain FP functions relate to an underlying mathematical function that is monotone:
Consider this pair of logarithm functions:
The "strict" spec is:
OTOH the
Mathspec copies that verbatim, and then weakens the contract on the return value by appending:So an Intel FPU or other implementation method might possibly make significand's final bit a random boolean. But when using such a method within the JVM, the overall implementation must ensure that significand, including that final ulp, offers monotonic FP results. This is for consistency with the underlying mathematical function which is itself monotone.