Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.

public final class StrictMath

  1. Object
  2. StrictMath
The JDK’s StrictMath. Every member answers exactly as the Math member of the same name: this runtime has one implementation of each function, so the results are the same on every platform it runs on, which is what StrictMath promises.

Fields

public static final double E = 2.718281828459045As Math.E.
public static final double PI = 3.141592653589793As Math.PI.
public static final double TAU = 6.283185307179586As Math.TAU.

Methods

public static double abs(double a)As Math.abs.
public static float abs(float a)As Math.abs.
public static int abs(int a)As Math.abs.
public static long abs(long a)As Math.abs.
public static double ceil(double a)As Math.ceil.
public static double cos(double a)As Math.cos.
public static double floor(double a)As Math.floor.
public static double max(double a, double b)As Math.max.
public static float max(float a, float b)As Math.max.
public static int max(int a, int b)As Math.max.
public static long max(long a, long b)As Math.max.
public static double min(double a, double b)As Math.min.
public static float min(float a, float b)As Math.min.
public static int min(int a, int b)As Math.min.
public static long min(long a, long b)As Math.min.
public static double sin(double a)As Math.sin.
public static double sqrt(double a)As Math.sqrt.
public static double tan(double a)As Math.tan.
public static double toDegrees(double a)As Math.toDegrees.
public static double toRadians(double a)As Math.toRadians.
public static long round(double a)As Math.round.
public static int round(float a)As Math.round.
public static double nextDown(double a)As Math.nextDown.
public static double nextAfter(double a, double b)As Math.nextAfter.
public static float nextAfter(float a, double b)As Math.nextAfter.
public static double random()As Math.random.
public static double signum(double a)As Math.signum.
public static float signum(float a)As Math.signum.
public static double copySign(double a, double b)As Math.copySign.
public static float copySign(float a, float b)As Math.copySign.
public static int getExponent(double a)As Math.getExponent.
public static int getExponent(float a)As Math.getExponent.
public static double ulp(double a)As Math.ulp.
public static float ulp(float a)As Math.ulp.
public static double nextUp(double a)As Math.nextUp.
public static float nextUp(float a)As Math.nextUp.
public static float nextDown(float a)As Math.nextDown.
public static double scalb(double a, int b)As Math.scalb.
public static float scalb(float a, int b)As Math.scalb.
public static double hypot(double a, double b)As Math.hypot.
public static double cbrt(double a)As Math.cbrt.
public static double rint(double a)As Math.rint.
public static double sinh(double a)As Math.sinh.
public static double cosh(double a)As Math.cosh.
public static double tanh(double a)As Math.tanh.
public static int floorDiv(int a, int b)As Math.floorDiv.
public static long floorDiv(long a, int b)As Math.floorDiv.
public static long floorDiv(long a, long b)As Math.floorDiv.
public static int floorMod(int a, int b)As Math.floorMod.
public static int floorMod(long a, int b)As Math.floorMod.
public static long floorMod(long a, long b)As Math.floorMod.
public static int ceilDiv(int a, int b)As Math.ceilDiv.
public static long ceilDiv(long a, int b)As Math.ceilDiv.
public static long ceilDiv(long a, long b)As Math.ceilDiv.
public static int ceilMod(int a, int b)As Math.ceilMod.
public static int ceilMod(long a, int b)As Math.ceilMod.
public static long ceilMod(long a, long b)As Math.ceilMod.
public static int divideExact(int a, int b)As Math.divideExact.
public static long divideExact(long a, long b)As Math.divideExact.
public static int floorDivExact(int a, int b)As Math.floorDivExact.
public static long floorDivExact(long a, long b)As Math.floorDivExact.
public static int ceilDivExact(int a, int b)As Math.ceilDivExact.
public static long ceilDivExact(long a, long b)As Math.ceilDivExact.
public static int addExact(int a, int b)As Math.addExact.
public static long addExact(long a, long b)As Math.addExact.
public static int subtractExact(int a, int b)As Math.subtractExact.
public static long subtractExact(long a, long b)As Math.subtractExact.
public static int multiplyExact(int a, int b)As Math.multiplyExact.
public static long multiplyExact(long a, int b)As Math.multiplyExact.
public static long multiplyExact(long a, long b)As Math.multiplyExact.
public static long multiplyFull(int a, int b)As Math.multiplyFull.
public static long multiplyHigh(long a, long b)As Math.multiplyHigh.
public static long unsignedMultiplyHigh(long a, long b)As Math.unsignedMultiplyHigh.
public static int incrementExact(int a)As Math.incrementExact.
public static long incrementExact(long a)As Math.incrementExact.
public static int decrementExact(int a)As Math.decrementExact.
public static long decrementExact(long a)As Math.decrementExact.
public static int negateExact(int a)As Math.negateExact.
public static long negateExact(long a)As Math.negateExact.
public static int toIntExact(long a)As Math.toIntExact.
public static int absExact(int a)As Math.absExact.
public static long absExact(long a)As Math.absExact.
public static int clamp(long a, int b, int c)As Math.clamp.
public static long clamp(long a, long b, long c)As Math.clamp.
public static double clamp(double a, double b, double c)As Math.clamp.
public static float clamp(float a, float b, float c)As Math.clamp.

Inherited methods

Field details

E

public static final double E = 2.718281828459045
As Math.E.

PI

public static final double PI = 3.141592653589793
As Math.PI.

TAU

public static final double TAU = 6.283185307179586
As Math.TAU.

Method details

abs

public static double abs(double a)
As Math.abs.

abs

public static float abs(float a)
As Math.abs.

abs

public static int abs(int a)
As Math.abs.

abs

public static long abs(long a)
As Math.abs.

ceil

public static double ceil(double a)
As Math.ceil.

cos

public static double cos(double a)
As Math.cos.

floor

public static double floor(double a)
As Math.floor.

max

public static double max(double a, double b)
As Math.max.

max

public static float max(float a, float b)
As Math.max.

max

public static int max(int a, int b)
As Math.max.

max

public static long max(long a, long b)
As Math.max.

min

public static double min(double a, double b)
As Math.min.

min

public static float min(float a, float b)
As Math.min.

min

public static int min(int a, int b)
As Math.min.

min

public static long min(long a, long b)
As Math.min.

sin

public static double sin(double a)
As Math.sin.

sqrt

public static double sqrt(double a)
As Math.sqrt.

tan

public static double tan(double a)
As Math.tan.

toDegrees

public static double toDegrees(double a)
As Math.toDegrees.

toRadians

public static double toRadians(double a)
As Math.toRadians.

round

public static long round(double a)
As Math.round.

round

public static int round(float a)
As Math.round.

nextDown

public static double nextDown(double a)
As Math.nextDown.

nextAfter

public static double nextAfter(double a, double b)
As Math.nextAfter.

nextAfter

public static float nextAfter(float a, double b)
As Math.nextAfter.

random

public static double random()
As Math.random.

signum

public static double signum(double a)
As Math.signum.

signum

public static float signum(float a)
As Math.signum.

copySign

public static double copySign(double a, double b)
As Math.copySign.

copySign

public static float copySign(float a, float b)
As Math.copySign.

getExponent

public static int getExponent(double a)
As Math.getExponent.

getExponent

public static int getExponent(float a)
As Math.getExponent.

ulp

public static double ulp(double a)
As Math.ulp.

ulp

public static float ulp(float a)
As Math.ulp.

nextUp

public static double nextUp(double a)
As Math.nextUp.

nextUp

public static float nextUp(float a)
As Math.nextUp.

nextDown

public static float nextDown(float a)
As Math.nextDown.

scalb

public static double scalb(double a, int b)
As Math.scalb.

scalb

public static float scalb(float a, int b)
As Math.scalb.

hypot

public static double hypot(double a, double b)
As Math.hypot.

cbrt

public static double cbrt(double a)
As Math.cbrt.

rint

public static double rint(double a)
As Math.rint.

sinh

public static double sinh(double a)
As Math.sinh.

cosh

public static double cosh(double a)
As Math.cosh.

tanh

public static double tanh(double a)
As Math.tanh.

floorDiv

public static int floorDiv(int a, int b)
As Math.floorDiv.

floorDiv

public static long floorDiv(long a, int b)
As Math.floorDiv.

floorDiv

public static long floorDiv(long a, long b)
As Math.floorDiv.

floorMod

public static int floorMod(int a, int b)
As Math.floorMod.

floorMod

public static int floorMod(long a, int b)
As Math.floorMod.

floorMod

public static long floorMod(long a, long b)
As Math.floorMod.

ceilDiv

public static int ceilDiv(int a, int b)
As Math.ceilDiv.

ceilDiv

public static long ceilDiv(long a, int b)
As Math.ceilDiv.

ceilDiv

public static long ceilDiv(long a, long b)
As Math.ceilDiv.

ceilMod

public static int ceilMod(int a, int b)
As Math.ceilMod.

ceilMod

public static int ceilMod(long a, int b)
As Math.ceilMod.

ceilMod

public static long ceilMod(long a, long b)
As Math.ceilMod.

divideExact

public static int divideExact(int a, int b)
As Math.divideExact.

divideExact

public static long divideExact(long a, long b)
As Math.divideExact.

floorDivExact

public static int floorDivExact(int a, int b)
As Math.floorDivExact.

floorDivExact

public static long floorDivExact(long a, long b)
As Math.floorDivExact.

ceilDivExact

public static int ceilDivExact(int a, int b)
As Math.ceilDivExact.

ceilDivExact

public static long ceilDivExact(long a, long b)
As Math.ceilDivExact.

addExact

public static int addExact(int a, int b)
As Math.addExact.

addExact

public static long addExact(long a, long b)
As Math.addExact.

subtractExact

public static int subtractExact(int a, int b)
As Math.subtractExact.

subtractExact

public static long subtractExact(long a, long b)
As Math.subtractExact.

multiplyExact

public static int multiplyExact(int a, int b)
As Math.multiplyExact.

multiplyExact

public static long multiplyExact(long a, int b)
As Math.multiplyExact.

multiplyExact

public static long multiplyExact(long a, long b)
As Math.multiplyExact.

multiplyFull

public static long multiplyFull(int a, int b)
As Math.multiplyFull.

multiplyHigh

public static long multiplyHigh(long a, long b)
As Math.multiplyHigh.

unsignedMultiplyHigh

public static long unsignedMultiplyHigh(long a, long b)
As Math.unsignedMultiplyHigh.

incrementExact

public static int incrementExact(int a)
As Math.incrementExact.

incrementExact

public static long incrementExact(long a)
As Math.incrementExact.

decrementExact

public static int decrementExact(int a)
As Math.decrementExact.

decrementExact

public static long decrementExact(long a)
As Math.decrementExact.

negateExact

public static int negateExact(int a)
As Math.negateExact.

negateExact

public static long negateExact(long a)
As Math.negateExact.

toIntExact

public static int toIntExact(long a)
As Math.toIntExact.

absExact

public static int absExact(int a)
As Math.absExact.

absExact

public static long absExact(long a)
As Math.absExact.

clamp

public static int clamp(long a, int b, int c)
As Math.clamp.

clamp

public static long clamp(long a, long b, long c)
As Math.clamp.

clamp

public static double clamp(double a, double b, double c)
As Math.clamp.

clamp

public static float clamp(float a, float b, float c)
As Math.clamp.