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 Name | Data Type | Description |
---|---|---|
a | float | the dividend |
b | float | the divisor |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: the remainder when a is divided by b |
function absFloat(float val) (float )
Returns the absolute value of a float value
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
val | float | value to get absolute value |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: absolute value |
function absInt(int val) (int )
Returns the absolute value of an int value
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
val | int | value to get the absolute value |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
int | int: 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 Name | Data Type | Description |
---|---|---|
val | float | value to get the arc cosine |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: arc cosine value |
function asin(float val) (float )
Returns the arc sine of a value
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
val | float | value to get the arc sine |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: arc sine value |
function atan(float val) (float )
Returns the arc tangent of a value
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
val | float | value to get the arc tangent |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: 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 Name | Data Type | Description |
---|---|---|
a | float | the ordinate coordinate |
b | float | the abscissa coordinate |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: the result |
function cbrt(float val) (float )
Returns the cube root of a float value
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
val | float | value to get the cube root |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: 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 Name | Data Type | Description |
---|---|---|
val | float | value to get the ceil |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: 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 Name | Data Type | Description |
---|---|---|
a | float | magnitude: the parameter providing the magnitude of the result |
b | float | magnitude: the parameter providing the magnitude of the result |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: the result |
function cos(float val) (float )
Returns the trigonometric cosine of an angle
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
val | float | value to get the trigonometric cosine |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: the result |
function cosh(float val) (float )
Returns the hyperbolic cosine of a float value
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
val | float | The number whose hyperbolic cosine is to be returned |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: 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 Name | Data Type | Description |
---|---|---|
val | float | exponent value to raise |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: exp value |
function expm1(float val) (float )
Returns (e to the power of x) -1
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
val | float | The exponent to raise e to in the computation |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: 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 Name | Data Type | Description |
---|---|---|
val | float | a float value |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: 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 Name | Data Type | Description |
---|---|---|
a | int | the dividend |
b | int | the divisor |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
int | int: the result |
function floorMod(int a, int b) (int )
Returns the floor modulus of the long arguments
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
a | int | the dividend |
b | int | the divisor |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
int | int: the result |
function getExponent(float val) (int )
Returns the unbiased exponent used in the representation of a float
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
val | float | float value |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
int | int: 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 Name | Data Type | Description |
---|---|---|
a | float | float value |
b | float | float value |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: the result |
function log(float val) (float )
Returns the natural logarithm (base e) of a float value
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
val | float | a float value |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: the result |
function log10(float val) (float )
Returns the base 10 logarithm of a float value
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
val | float | a float value |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: 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 Name | Data Type | Description |
---|---|---|
val | float | a float value |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: the natural log of x + 1 |
function negateExact(int val) (int )
Returns the negation of the argument
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
val | int | the value to negate |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
int | int: 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 Name | Data Type | Description |
---|---|---|
a | float | starting floating-point value |
b | float | value indicating which of start's neighbors or start should be returned |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: the result |
function nextDown(float val) (float )
Returns the adjacent floating-point value closer to negative infinity
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
val | float | starting floating-point value |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: the result |
function nextUp(float val) (float )
Returns the adjacent floating-point value closer to positive infinity
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
val | float | starting floating-point value |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: the result |
function pow(float a, float b) (float )
Returns the value of the 'a' raised to the power of 'b'
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
a | float | the base value |
b | float | the exponent value |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: result value |
function random() (float )
Returns a random number between 0.0 and 1.0
Parameters:
Parameter Name | Data Type | Description |
---|
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: random value |
function randomInRange(int start, int end) (int )
Returns a random number between given start(inclusive) and end(exclusive) values
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
start | int | range start value |
end | int | range end value |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
int | float: 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 Name | Data Type | Description |
---|---|---|
val | float | a float value |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: the result |
function round(float val) (int )
Returns the closest int to the argument, with ties rounding to positive infinity
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
val | float | a floating-point value to be rounded to an integer |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
int | int: 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 Name | Data Type | Description |
---|---|---|
a | float | number to be scaled by a power of two |
b | int | a: number to be scaled by a power of two |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: the result |
function signum(float val) (float )
Returns the signum function of the argument
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
val | float | the floating-point value whose signum is to be returned |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: the signum function of the argument |
function sin(float val) (float )
Returns the trigonometric sine of an angle
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
val | float | an angle, in radians |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: the sine of the argument |
function sinh(float val) (float )
Returns the hyperbolic sine of a float value
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
val | float | the number whose hyperbolic sine is to be returned |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: the hyperbolic sine of a given float |
function sqrt(float val) (float )
Returns rounded positive square root of the given value
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
val | float | value to get square root |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: square root value |
function tan(float val) (float )
Returns the trigonometric tangent of an angle
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
val | float | an angle, in radians |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: the tangent of the argument |
function tanh(float val) (float )
Returns the hyperbolic tangent of a double value
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
val | float | the number whose hyperbolic tangent is to be returned |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: 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 Name | Data Type | Description |
---|---|---|
val | float | an angle, in radians |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: 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 Name | Data Type | Description |
---|---|---|
val | float | an angle, in degrees |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: the measurement of the angle angdeg in radians |
function ulp(float val) (float )
Returns the size of an ulp of the argument
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
val | float | the floating-point value whose ulp is to be returned |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | float: the size of an ulp of the argument |