Global variables of ballerina.math package
Variable Name | Data Type | Description |
---|---|---|
PI | float | The ratio of the circumference of a circle to its diameter |
E | float | The 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 Name | Data Type | Description |
---|---|---|
a | float | The dividend |
b | float | The divisor |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | The remainder when a is divided by b |
public 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 | Absolute value |
public 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 | Absolute 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 Name | Data Type | Description |
---|---|---|
val | float | Value to get the arc cosine |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | Arc cosine value |
public 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 | Arc sine value |
public 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 | Arc 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 Name | Data Type | Description |
---|---|---|
a | float | The ordinate coordinate |
b | float | The abscissa coordinate |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | The result |
public 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 | Cube 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 Name | Data Type | Description |
---|---|---|
val | float | Value to get the ceil |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | The 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 Name | Data Type | Description |
---|---|---|
a | float | magnitude: The parameter providing the magnitude of the result |
b | float | sign: The parameter providing the sign of the result |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | The result |
public 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 | The result |
public 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 | The 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 Name | Data Type | Description |
---|---|---|
val | float | Exponent value to raise |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | Exp value |
public 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 | The 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 Name | Data Type | Description |
---|---|---|
val | float | A float value |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | The 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 Name | Data Type | Description |
---|---|---|
a | int | The dividend |
b | int | The divisor |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
int | The result |
public 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 | The result |
public 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 | The 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 Name | Data Type | Description |
---|---|---|
a | float | Float value |
b | float | Float value |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | the result |
public 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 | The result |
public 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 | The 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 Name | Data Type | Description |
---|---|---|
val | float | A float value |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | The natural log of x + 1 |
public 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 | The 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 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 | The result |
public 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 | The result |
public 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 | The result |
public 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 | Result value |
public function random() (float)
Returns a random number between 0.0 and 1.0
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | Random value |
public 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 | Random 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 Name | Data Type | Description |
---|---|---|
val | float | A float value |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | The result |
public 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 | The 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 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 | The result |
public 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 | The signum function of the argument |
public 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 | The sine of the argument |
public 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 | The hyperbolic sine of a given float |
public 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 | Square root value |
public 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 | The tangent of the argument |
public 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 | The 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 Name | Data Type | Description |
---|---|---|
val | float | An angle, in radians |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | The 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 Name | Data Type | Description |
---|---|---|
val | float | An angle, in degrees |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
float | The measurement of the angle angdeg in radians |
public 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 | The size of an ulp of the argument |