Functions - math

absFloat

Returns the absolute value of a float value.

absInt

Returns the absolute value of an int value.

acos

Returns the arc cosine of a value; the returned angle is in the range 0.0 through pi.

asin

Returns the arc sine of a value.

atan

Returns the arc tangent of a value.

atan2

Returns the angle theta from the conversion of rectangular coordinates (a, b) to polar coordinates (r, theta).

cbrt

Returns the cube root of a float value.

ceil

Returns the smallest (closest to negative infinity) double value that is greater than orequal to the argument and is equal to a mathematical integer.

copySign

Returns the first floating-point argument with the sign of the second floating-point argument.

cos

Returns the trigonometric cosine of an angle.

cosh

Returns the hyperbolic cosine of a float value.

exp

Returns Euler's number, that is 'e' raised to the power of exponent.

expm1

Returns (e to the power of x) -1.

floor

Returns the largest (closest to positive infinity) float value that is less than or equal to the argument and is equal to a mathematical integer.

floorDiv

Returns the largest (closest to positive infinity) int value that is less than or equal to the algebraic quotient.

floorMod

Returns the floor modulus of the long arguments.

getExponent

Returns the unbiased exponent used in the representation of a float.

hypot

Returns sqrt(a squared +b squared) without intermediate overflow or underflow.

log

Returns the natural logarithm (base e) of a float value.

log10

Returns the base 10 logarithm of a float value.

log1p

Returns the natural logarithm of the sum of the argument and 1.

negateExact

Returns the negation of the argument.

nextAfter

Returns the floating-point number adjacent to the first argument in the direction of the second argument.

nextDown

Returns the adjacent floating-point value closer to negative infinity.

nextUp

Returns the adjacent floating-point value closer to positive infinity.

pow

Returns the value of the 'a' raised to the power of 'b'.

random

Returns a random number between 0.0 and 1.0.

randomInRange

Returns a random number between given start(inclusive) and end(exclusive) values.

remainder

Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard.

rint

Returns the double value that is closest in value to the argument and is equal to a mathematical integer.

round

Returns the closest int to the argument, with ties rounding to positive infinity.

scalb

Returns a × (2 to the power of b) rounded as if performed by a single correctly rounded floating-point multiply to a member of the float value set.

signum

Returns the signum function of the argument.

sin

Returns the trigonometric sine of an angle.

sinh

Returns the hyperbolic sine of a float value.

sqrt

Returns rounded positive square root of the given value.

tan

Returns the trigonometric tangent of an angle.

tanh

Returns the hyperbolic tangent of a double value.

toDegrees

Converts an angle measured in radians to an approximately equivalent angle measured in degrees.

toRadians

Converts an angle measured in degrees to an approximately equivalent angle measured in radians.

ulp

Returns the size of an ulp of the argument.

absFloat

(float val)

returns float

Returns the absolute value of a float value.

Parameters

  • val float
  • Value to get absolute value

  • Return Type

    (float)
  • Absolute value

absInt

(int val)

returns int

Returns the absolute value of an int value.

Parameters

  • val int
  • Value to get the absolute value

  • Return Type

    (int)
  • Absolute value

acos

(float val)

returns float

Returns the arc cosine of a value; the returned angle is in the range 0.0 through pi.

Parameters

  • val float
  • Value to get the arc cosine

  • Return Type

    (float)
  • Arc cosine value

asin

(float val)

returns float

Returns the arc sine of a value.

Parameters

  • val float
  • Value to get the arc sine

  • Return Type

    (float)
  • Arc sine value

atan

(float val)

returns float

Returns the arc tangent of a value.

Parameters

  • val float
  • Value to get the arc tangent

  • Return Type

    (float)
  • Arc tangent value

atan2

(float a, float b)

returns float

Returns the angle theta from the conversion of rectangular coordinates (a, b) to polar coordinates (r, theta).

Parameters

  • a float
  • The ordinate coordinate

  • b float
  • The abscissa coordinate

  • Return Type

    (float)
  • The result

cbrt

(float val)

returns float

Returns the cube root of a float value.

Parameters

  • val float
  • Value to get the cube root

  • Return Type

    (float)
  • Cube root value

ceil

(float val)

returns float

Returns the smallest (closest to negative infinity) double value that is greater than orequal to the argument and is equal to a mathematical integer.

Parameters

  • val float
  • Value to get the ceil

  • Return Type

    (float)
  • The result

copySign

(float a, float b)

returns float

Returns the first floating-point argument with the sign of the second floating-point argument.

Parameters

  • a float
  • The parameter providing the magnitude of the result

  • b float
  • The parameter providing the sign of the result

  • Return Type

    (float)
  • The result

cos

(float val)

returns float

Returns the trigonometric cosine of an angle.

Parameters

  • val float
  • Value to get the trigonometric cosine

  • Return Type

    (float)
  • The result

cosh

(float val)

returns float

Returns the hyperbolic cosine of a float value.

Parameters

  • val float
  • The number whose hyperbolic cosine is to be returned

  • Return Type

    (float)
  • The hyperbolic cosine of given float value

exp

(float val)

returns float

Returns Euler's number, that is 'e' raised to the power of exponent.

Parameters

  • val float
  • Exponent value to raise

  • Return Type

    (float)
  • Exp value

expm1

(float val)

returns float

Returns (e to the power of x) -1.

Parameters

  • val float
  • The exponent to raise e to in the computation

  • Return Type

    (float)
  • The result

floor

(float val)

returns float

Returns the largest (closest to positive infinity) float value that is less than or equal to the argument and is equal to a mathematical integer.

Parameters

  • val float
  • A float value

  • Return Type

    (float)
  • The result

floorDiv

(int a, int b)

returns int | Error

Returns the largest (closest to positive infinity) int value that is less than or equal to the algebraic quotient.

Parameters

  • a int
  • The dividend

  • b int
  • The divisor

  • Return Type

    (int | Error)
  • The result or Error if b is 0

floorMod

(int a, int b)

returns int | Error

Returns the floor modulus of the long arguments.

Parameters

  • a int
  • The dividend

  • b int
  • The divisor

  • Return Type

    (int | Error)
  • The result or Error if b is 0

getExponent

(float val)

returns int

Returns the unbiased exponent used in the representation of a float.

Parameters

  • val float
  • Float value

  • Return Type

    (int)
  • The unbiased exponent of the argument

hypot

(float a, float b)

returns float

Returns sqrt(a squared +b squared) without intermediate overflow or underflow.

Parameters

  • a float
  • Float value

  • b float
  • Float value

  • Return Type

    (float)
  • The result

log

(float val)

returns float

Returns the natural logarithm (base e) of a float value.

Parameters

  • val float
  • A float value

  • Return Type

    (float)
  • The result

log10

(float val)

returns float

Returns the base 10 logarithm of a float value.

Parameters

  • val float
  • A float value

  • Return Type

    (float)
  • The base 10 logarithm of a given float value

log1p

(float val)

returns float

Returns the natural logarithm of the sum of the argument and 1.

Parameters

  • val float
  • A float value

  • Return Type

    (float)
  • The natural log of x + 1

negateExact

(int val)

returns int | Error

Returns the negation of the argument.

Parameters

  • val int
  • The value to negate

  • Return Type

    (int | Error)
  • The result or Error if overflow occurred

nextAfter

(float a, float b)

returns float

Returns the floating-point number adjacent to the first argument in the direction of the second argument.

Parameters

  • a float
  • Starting floating-point value

  • b float
  • Value indicating which of start's neighbors or start should be returned

  • Return Type

    (float)
  • The result

nextDown

(float val)

returns float

Returns the adjacent floating-point value closer to negative infinity.

Parameters

  • val float
  • Starting floating-point value

  • Return Type

    (float)
  • The result

nextUp

(float val)

returns float

Returns the adjacent floating-point value closer to positive infinity.

Parameters

  • val float
  • Starting floating-point value

  • Return Type

    (float)
  • The result

pow

(float a, float b)

returns float

Returns the value of the 'a' raised to the power of 'b'.

Parameters

  • a float
  • The base value

  • b float
  • The exponent value

  • Return Type

    (float)
  • Result value

random

()

returns float

Returns a random number between 0.0 and 1.0.

  • Return Type

    (float)
  • Random value

randomInRange

(int startRange, int endRange)

returns int | Error

Returns a random number between given start(inclusive) and end(exclusive) values.

Parameters

  • startRange int
  • Range start value

  • endRange int
  • Range end value

  • Return Type

    (int | Error)
  • Random value or Error if start range is greater than the end range

remainder

(float a, float b)

returns float

Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard.

Parameters

  • a float
  • The dividend

  • b float
  • The divisor

  • Return Type

    (float)
  • The remainder when a is divided by b

rint

(float val)

returns float

Returns the double value that is closest in value to the argument and is equal to a mathematical integer.

Parameters

  • val float
  • A float value

  • Return Type

    (float)
  • The result

round

(float val)

returns int

Returns the closest int to the argument, with ties rounding to positive infinity.

Parameters

  • val float
  • A floating-point value to be rounded to an integer

  • Return Type

    (int)
  • The value of the argument rounded to the nearest int value

scalb

(float a, int b)

returns float

Returns a × (2 to the power of b) rounded as if performed by a single correctly rounded floating-point multiply to a member of the float value set.

Parameters

  • a float
  • Number to be scaled by a power of two

  • b int
  • Power of 2 used to scale a

  • Return Type

    (float)
  • The result

signum

(float val)

returns float

Returns the signum function of the argument.

Parameters

  • val float
  • The floating-point value whose signum is to be returned

  • Return Type

    (float)
  • The signum function of the argument

sin

(float val)

returns float

Returns the trigonometric sine of an angle.

Parameters

  • val float
  • An angle, in radians

  • Return Type

    (float)
  • The sine of the argument

sinh

(float val)

returns float

Returns the hyperbolic sine of a float value.

Parameters

  • val float
  • The number whose hyperbolic sine is to be returned

  • Return Type

    (float)
  • The hyperbolic sine of a given float

sqrt

(float val)

returns float

Returns rounded positive square root of the given value.

Parameters

  • val float
  • Value to get square root

  • Return Type

    (float)
  • Square root value

tan

(float val)

returns float

Returns the trigonometric tangent of an angle.

Parameters

  • val float
  • An angle, in radians

  • Return Type

    (float)
  • The tangent of the argument

tanh

(float val)

returns float

Returns the hyperbolic tangent of a double value.

Parameters

  • val float
  • The number whose hyperbolic tangent is to be returned

  • Return Type

    (float)
  • The hyperbolic tangent of x

toDegrees

(float val)

returns float

Converts an angle measured in radians to an approximately equivalent angle measured in degrees.

Parameters

  • val float
  • An angle, in radians

  • Return Type

    (float)
  • The measurement of the angle angrad in degrees

toRadians

(float val)

returns float

Converts an angle measured in degrees to an approximately equivalent angle measured in radians.

Parameters

  • val float
  • An angle, in degrees

  • Return Type

    (float)
  • The measurement of the angle angdeg in radians

ulp

(float val)

returns float

Returns the size of an ulp of the argument.

Parameters

  • val float
  • The floating-point value whose ulp is to be returned

  • Return Type

    (float)
  • The size of an ulp of the argument