Ballerina API Documentation

Functions of ballerina.lang.math package

function IEEEremainder(float a, float b) (float )

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

Parameters:

Parameter NameData TypeDescription
afloatthe dividend
bfloatthe divisor

Return Parameters:

Return VariableData TypeDescription
floatfloat: the remainder when a is divided by b

function absFloat(float val) (float )

Returns the absolute value of a float value

Parameters:

Parameter NameData TypeDescription
valfloatvalue to get absolute value

Return Parameters:

Return VariableData TypeDescription
floatfloat: absolute value

function absInt(int val) (int )

Returns the absolute value of an int value

Parameters:

Parameter NameData TypeDescription
valintvalue to get the absolute value

Return Parameters:

Return VariableData TypeDescription
intint: absolute value

function acos(float val) (float )

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

Parameters:

Parameter NameData TypeDescription
valfloatvalue to get the arc cosine

Return Parameters:

Return VariableData TypeDescription
floatfloat: arc cosine value

function asin(float val) (float )

Returns the arc sine of a value

Parameters:

Parameter NameData TypeDescription
valfloatvalue to get the arc sine

Return Parameters:

Return VariableData TypeDescription
floatfloat: arc sine value

function atan(float val) (float )

Returns the arc tangent of a value

Parameters:

Parameter NameData TypeDescription
valfloatvalue to get the arc tangent

Return Parameters:

Return VariableData TypeDescription
floatfloat: arc tangent value

function atan2(float a, float b) (float )

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

Parameters:

Parameter NameData TypeDescription
afloatthe ordinate coordinate
bfloatthe abscissa coordinate

Return Parameters:

Return VariableData TypeDescription
floatfloat: the result

function cbrt(float val) (float )

Returns the cube root of a float value

Parameters:

Parameter NameData TypeDescription
valfloatvalue to get the cube root

Return Parameters:

Return VariableData TypeDescription
floatfloat: cube root value

function ceil(float val) (float )

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

Parameters:

Parameter NameData TypeDescription
valfloatvalue to get the ceil

Return Parameters:

Return VariableData TypeDescription
floatfloat: the result

function copySign(float a, float b) (float )

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

Parameters:

Parameter NameData TypeDescription
afloatmagnitude: the parameter providing the magnitude of the result
bfloatmagnitude: the parameter providing the magnitude of the result

Return Parameters:

Return VariableData TypeDescription
floatfloat: the result

function cos(float val) (float )

Returns the trigonometric cosine of an angle

Parameters:

Parameter NameData TypeDescription
valfloatvalue to get the trigonometric cosine

Return Parameters:

Return VariableData TypeDescription
floatfloat: the result

function cosh(float val) (float )

Returns the hyperbolic cosine of a float value

Parameters:

Parameter NameData TypeDescription
valfloatThe number whose hyperbolic cosine is to be returned

Return Parameters:

Return VariableData TypeDescription
floatfloat: The hyperbolic cosine of given float value

function exp(float val) (float )

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

Parameters:

Parameter NameData TypeDescription
valfloatexponent value to raise

Return Parameters:

Return VariableData TypeDescription
floatfloat: exp value

function expm1(float val) (float )

Returns (e to the power of x) -1

Parameters:

Parameter NameData TypeDescription
valfloatThe exponent to raise e to in the computation

Return Parameters:

Return VariableData TypeDescription
floatfloat: the result

function floor(float val) (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:

Parameter NameData TypeDescription
valfloata float value

Return Parameters:

Return VariableData TypeDescription
floatfloat: the result

function floorDiv(int a, int b) (int )

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

Parameters:

Parameter NameData TypeDescription
aintthe dividend
bintthe divisor

Return Parameters:

Return VariableData TypeDescription
intint: the result

function floorMod(int a, int b) (int )

Returns the floor modulus of the long arguments

Parameters:

Parameter NameData TypeDescription
aintthe dividend
bintthe divisor

Return Parameters:

Return VariableData TypeDescription
intint: the result

function getExponent(float val) (int )

Returns the unbiased exponent used in the representation of a float

Parameters:

Parameter NameData TypeDescription
valfloatfloat value

Return Parameters:

Return VariableData TypeDescription
intint: the unbiased exponent of the argument

function hypot(float a, float b) (float )

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

Parameters:

Parameter NameData TypeDescription
afloatfloat value
bfloatfloat value

Return Parameters:

Return VariableData TypeDescription
floatfloat: the result

function log(float val) (float )

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

Parameters:

Parameter NameData TypeDescription
valfloata float value

Return Parameters:

Return VariableData TypeDescription
floatfloat: the result

function log10(float val) (float )

Returns the base 10 logarithm of a float value

Parameters:

Parameter NameData TypeDescription
valfloata float value

Return Parameters:

Return VariableData TypeDescription
floatfloat: the base 10 logarithm of a given float value

function log1p(float val) (float )

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

Parameters:

Parameter NameData TypeDescription
valfloata float value

Return Parameters:

Return VariableData TypeDescription
floatfloat: the natural log of x + 1

function negateExact(int val) (int )

Returns the negation of the argument

Parameters:

Parameter NameData TypeDescription
valintthe value to negate

Return Parameters:

Return VariableData TypeDescription
intint: the result

function nextAfter(float a, float b) (float )

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

Parameters:

Parameter NameData TypeDescription
afloatstarting floating-point value
bfloatvalue indicating which of start's neighbors or start should be returned

Return Parameters:

Return VariableData TypeDescription
floatfloat: the result

function nextDown(float val) (float )

Returns the adjacent floating-point value closer to negative infinity

Parameters:

Parameter NameData TypeDescription
valfloatstarting floating-point value

Return Parameters:

Return VariableData TypeDescription
floatfloat: the result

function nextUp(float val) (float )

Returns the adjacent floating-point value closer to positive infinity

Parameters:

Parameter NameData TypeDescription
valfloatstarting floating-point value

Return Parameters:

Return VariableData TypeDescription
floatfloat: the result

function pow(float a, float b) (float )

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

Parameters:

Parameter NameData TypeDescription
afloatthe base value
bfloatthe exponent value

Return Parameters:

Return VariableData TypeDescription
floatfloat: result value

function random() (float )

Returns a random number between 0.0 and 1.0

Parameters:

Parameter NameData TypeDescription

Return Parameters:

Return VariableData TypeDescription
floatfloat: random value

function randomInRange(int start, int end) (int )

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

Parameters:

Parameter NameData TypeDescription
startintrange start value
endintrange end value

Return Parameters:

Return VariableData TypeDescription
intfloat: random value

function rint(float val) (float )

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

Parameters:

Parameter NameData TypeDescription
valfloata float value

Return Parameters:

Return VariableData TypeDescription
floatfloat: the result

function round(float val) (int )

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

Parameters:

Parameter NameData TypeDescription
valfloata floating-point value to be rounded to an integer

Return Parameters:

Return VariableData TypeDescription
intint: the value of the argument rounded to the nearest int value

function scalb(float a, int b) (float )

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

Parameters:

Parameter NameData TypeDescription
afloatnumber to be scaled by a power of two
binta: number to be scaled by a power of two

Return Parameters:

Return VariableData TypeDescription
floatfloat: the result

function signum(float val) (float )

Returns the signum function of the argument

Parameters:

Parameter NameData TypeDescription
valfloatthe floating-point value whose signum is to be returned

Return Parameters:

Return VariableData TypeDescription
floatfloat: the signum function of the argument

function sin(float val) (float )

Returns the trigonometric sine of an angle

Parameters:

Parameter NameData TypeDescription
valfloatan angle, in radians

Return Parameters:

Return VariableData TypeDescription
floatfloat: the sine of the argument

function sinh(float val) (float )

Returns the hyperbolic sine of a float value

Parameters:

Parameter NameData TypeDescription
valfloatthe number whose hyperbolic sine is to be returned

Return Parameters:

Return VariableData TypeDescription
floatfloat: the hyperbolic sine of a given float

function sqrt(float val) (float )

Returns rounded positive square root of the given value

Parameters:

Parameter NameData TypeDescription
valfloatvalue to get square root

Return Parameters:

Return VariableData TypeDescription
floatfloat: square root value

function tan(float val) (float )

Returns the trigonometric tangent of an angle

Parameters:

Parameter NameData TypeDescription
valfloatan angle, in radians

Return Parameters:

Return VariableData TypeDescription
floatfloat: the tangent of the argument

function tanh(float val) (float )

Returns the hyperbolic tangent of a double value

Parameters:

Parameter NameData TypeDescription
valfloatthe number whose hyperbolic tangent is to be returned

Return Parameters:

Return VariableData TypeDescription
floatfloat: the hyperbolic tangent of x

function toDegrees(float val) (float )

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

Parameters:

Parameter NameData TypeDescription
valfloatan angle, in radians

Return Parameters:

Return VariableData TypeDescription
floatfloat: the measurement of the angle angrad in degrees

function toRadians(float val) (float )

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

Parameters:

Parameter NameData TypeDescription
valfloatan angle, in degrees

Return Parameters:

Return VariableData TypeDescription
floatfloat: the measurement of the angle angdeg in radians

function ulp(float val) (float )

Returns the size of an ulp of the argument

Parameters:

Parameter NameData TypeDescription
valfloatthe floating-point value whose ulp is to be returned

Return Parameters:

Return VariableData TypeDescription
floatfloat: the size of an ulp of the argument


Menu

  • Functions
    • IEEEremainder(float a, float b) (float )
    • absFloat(float val) (float )
    • absInt(int val) (int )
    • acos(float val) (float )
    • asin(float val) (float )
    • atan(float val) (float )
    • atan2(float a, float b) (float )
    • cbrt(float val) (float )
    • ceil(float val) (float )
    • copySign(float a, float b) (float )
    • cos(float val) (float )
    • cosh(float val) (float )
    • exp(float val) (float )
    • expm1(float val) (float )
    • floor(float val) (float )
    • floorDiv(int a, int b) (int )
    • floorMod(int a, int b) (int )
    • getExponent(float val) (int )
    • hypot(float a, float b) (float )
    • log(float val) (float )
    • log10(float val) (float )
    • log1p(float val) (float )
    • negateExact(int val) (int )
    • nextAfter(float a, float b) (float )
    • nextDown(float val) (float )
    • nextUp(float val) (float )
    • pow(float a, float b) (float )
    • random() (float )
    • randomInRange(int start, int end) (int )
    • rint(float val) (float )
    • round(float val) (int )
    • scalb(float a, int b) (float )
    • signum(float val) (float )
    • sin(float val) (float )
    • sinh(float val) (float )
    • sqrt(float val) (float )
    • tan(float val) (float )
    • tanh(float val) (float )
    • toDegrees(float val) (float )
    • toRadians(float val) (float )
    • ulp(float val) (float )

Copyright 2017 Ballerina API Documentation