Ballerina API Documentation

Global variables of ballerina.math package

Variable NameData TypeDescription
PIfloatThe ratio of the circumference of a circle to its diameter
EfloatThe base of the natural logarithms

Functions of ballerina.math package

public 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
floatThe remainder when a is divided by b

public 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
floatAbsolute value

public 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
intAbsolute value

public 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
floatArc cosine value

public 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
floatArc sine value

public 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
floatArc tangent value

public 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
floatThe result

public 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
floatCube root value

public 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
floatThe result

public 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
bfloatsign: The parameter providing the sign of the result

Return Parameters:

Return VariableData TypeDescription
floatThe result

public 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
floatThe result

public 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
floatThe hyperbolic cosine of given float value

public 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
floatExp value

public 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
floatThe result

public 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
floatThe result

public 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
intThe result

public 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
intThe result

public 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
intThe unbiased exponent of the argument

public 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
floatthe result

public 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
floatThe result

public 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
floatThe base 10 logarithm of a given float value

public 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
floatThe natural log of x + 1

public function negateExact(int val) (int)

Returns the negation of the argument

Parameters:

Parameter NameData TypeDescription
valintThe value to negate

Return Parameters:

Return VariableData TypeDescription
intThe result

public 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
floatThe result

public 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
floatThe result

public 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
floatThe result

public 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
floatResult value

public function random() (float)

Returns a random number between 0.0 and 1.0

Return Parameters:

Return VariableData TypeDescription
floatRandom value

public 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
intRandom value

public 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
floatThe result

public 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
intThe value of the argument rounded to the nearest int value

public 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
floatThe result

public 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
floatThe signum function of the argument

public 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
floatThe sine of the argument

public 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
floatThe hyperbolic sine of a given float

public 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
floatSquare root value

public 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
floatThe tangent of the argument

public 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
floatThe hyperbolic tangent of x

public 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
floatThe measurement of the angle angrad in degrees

public 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
floatThe measurement of the angle angdeg in radians

public 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
floatThe size of an ulp of the argument


Menu

  • Global Variables
    • PI
    • E
  • 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