Class ExtraMath

java.lang.Object
dev.pfaff.log4truth.ExtraMath

public final class ExtraMath extends Object
A collection of math utilities.

Quick

The quick utilities have various caveats including loss of precision, and unspecified behaviour given certain inputs.

Min/Max

Which of the input values is returned from the floating-point min/max methods when at least one is NaN is unspecified.

Clamp

The clamp methods perform no sanity checks on the inputs. Min values greater than the max value will produce unspecified results.

Which of the input values is returned from the floating-point clamp methods when at least one is NaN is unspecified, except when neither the min nor the max values are NaN, in which case the value is guaranteed to be within the specified range.

If the min is 0.0 and the value is -0.0, or if the max is -0.0 and the value is 0.0, whether the returned value is 0.0 or -0.0 is unspecified.

  • Method Details

    • log10

      public static int log10(int n)
      Fast integer log10.

      Returns -1 for input 0 and the number of base10 digits minus 1 otherwise.

    • log10p1

      public static int log10p1(int n)
      Fast integer log10 plus 1.

      Returns 0 for input 0 and the number of base10 digits otherwise.