Functions -
lang.float
abs | IEEE abs operation. |
acos | IEEE acos operation |
asin | IEEE asin operation |
atan | IEEE atan operation |
atan2 | IEEE atan2(y, x) operation |
cbrt | Cube root. IEEE rootn(x, 3) |
ceiling | Smallest (closest to -∞) floating point value not less than |
cos | IEEE cos operation |
cosh | IEEE cosh operation |
exp | IEEE exp operation |
floor | Largest (closest to +∞) floating point value not greater than |
fromBitsInt | Returns the float that is represented in IEEE 64-bit floating point by |
fromHexString | Return the float value represented by
|
fromString | Return the float value represented by
|
isFinite | Tests whether a float is finite. Exactly one of isFinite, isInfinite and IsNaN will be true for any float value |
isInfinite | Tests whether a float is infinite. Exactly one of isFinite, isInfinite and IsNaN will be true for any float value |
isNaN | Tests whether a float is NaN. Exactly one of isFinite, isInfinite and IsNaN will be true for any float value. |
log | Natural logarithm. IEEE log operation |
log10 | Base 10 log. IEEE log10 operation |
max | Maximum of all the arguments. (positive)∞ if no args NaN if any arg is NaN |
min | Minimum of all the arguments. ∞ if no args NaN if any arg is NaN |
pow |
|
round | Floating point value that is a mathematical integer and closest to |
sin | IEEE sin operation |
sinh | IEEE sinh operation |
sqrt | IEEE squareRoot operation. |
sum | Sum of all the arguments. (positive)0.0 if no args NaN if any arg is NaN |
tan | IEEE tan operation |
tanh | IEEE tanh operation |
toBitsInt | Returns IEEE 64-bit binary floating point format representation of |
toHexString | Returns a string that represents
|
IEEE abs operation.
Parameters
- x float
-
whose absolute value is to be determined
-
Return Type
(float) absolute value of the argument
IEEE acos operation
Parameters
- x float
-
a cos value
-
Return Type
(float) the arc cosine of the argument
IEEE atan2(y, x) operation
-
Return Type
(float) the angle component in polar coordinate
Cube root. IEEE rootn(x, 3)
Parameters
- x float
-
value to performe cube root operation on
-
Return Type
(float) cube root of the argument
Smallest (closest to -∞) floating point value not less than x
that is a mathematical integer
Parameters
- x float
-
value to performe ceiling on
-
Return Type
(float) integer ceiling value of the argument in float
IEEE cos operation
Parameters
- x float
-
an angle, in radians
-
Return Type
(float) the cos of the argument
IEEE cosh operation
Parameters
- x float
-
the number to take cosh
-
Return Type
(float) hyperbolic cos of x
IEEE exp operation
Parameters
- x float
-
exponent
-
Return Type
(float) Euler's number raised to the power
x
Largest (closest to +∞) floating point value not greater than x
that is a mathematical integer
Parameters
- x float
-
whose value to be floored
-
Return Type
(float) floored value
Returns the float that is represented in IEEE 64-bit floating point by x
.
All bit patterns that IEEE defines to be NaNs will all be mapped to the single float NaN value.
Parameters
- x int
-
int value
-
Return Type
(float) x
bit pattern as a float
Return the float value represented by s
.
s
must follow the syntax of HexFloatingPointLiteral as defined by the Ballerina specification
with the following modifications
- the HexFloatingPointLiteral may have a leading
+
or-
sign NaN
is allowedInfinity
is allowed with an optional leading+
or-
sign
Parameters
- s string
-
hexadecimal floating point hex string representation
Return the float value represented by s
.
s
must follow the syntax of DecimalFloatingPointNumber as defined by the Ballerina specification
with the following modifications
- the DecimalFloatingPointNumber may have a leading
+
or-
sign NaN
is allowedInfinity
is allowed with an optional leading+
or-
sign- a FloatingPointTypeSuffix is not allowed
This is the inverse of
value:toString
applied to anfloat
.
Parameters
- s string
-
string representation of a float
Tests whether a float is finite. Exactly one of isFinite, isInfinite and IsNaN will be true for any float value
Parameters
- x float
-
the float to be tested
-
Return Type
(boolean) true if
x
is finite, i.e. neither NaN nor +∞ nor -∞
Tests whether a float is infinite. Exactly one of isFinite, isInfinite and IsNaN will be true for any float value
Parameters
- x float
-
the float to be tested
-
Return Type
(boolean) true if
x
is either +∞ nor -∞
Tests whether a float is NaN. Exactly one of isFinite, isInfinite and IsNaN will be true for any float value.
Parameters
- x float
-
the float to be tested
-
Return Type
(boolean) true if
x
is NaN
Natural logarithm. IEEE log operation
Parameters
- x float
-
value to take log
-
Return Type
(float) natural logarithm of
x
Base 10 log. IEEE log10 operation
Parameters
- x float
-
value to take log
-
Return Type
(float) base 10 logarithm of
x
Maximum of all the arguments. (positive)∞ if no args NaN if any arg is NaN
Parameters
- xs float[]
-
parameters to check for max value
-
Return Type
(float) maximum value of all provided values
Minimum of all the arguments. ∞ if no args NaN if any arg is NaN
Parameters
- xs float[]
-
parameters to check for min value
-
Return Type
(float) minimum value of all provided values
x
to the power of y
.
IEEE pow(x, y)
-
Return Type
(float) x
raise to the power ofy
Floating point value that is a mathematical integer and closest to x
.
If there are two such integers, choose the one that is even
(this is the round-to-nearest rounding mode, which is the default for IEEE and for Ballerina).
Same as Java Math.rint method
Same as .NET Math.Round method
IEEE roundToIntegralTiesToEven operation
Note that <int>x
is the same as <int>x.round()
Parameters
- x float
-
whose value to be rounded
-
Return Type
(float) rounded value
IEEE sin operation
Parameters
- x float
-
an angle, in radians
-
Return Type
(float) the sin of the argument
IEEE sinh operation
Parameters
- x float
-
the number to take sinh
-
Return Type
(float) hyperbolic sin of
x
IEEE squareRoot operation.
Parameters
- x float
-
value to performe squareRoot operation on
-
Return Type
(float) squareRoot of the argument
Sum of all the arguments. (positive)0.0 if no args NaN if any arg is NaN
Parameters
- xs float[]
-
float numbers to sum
-
Return Type
(float) sum of the parameters
IEEE tan operation
Parameters
- x float
-
an angle, in radians
-
Return Type
(float) the tan of the argument
IEEE tanh operation
Parameters
- x float
-
the number to take tanh
-
Return Type
(float) hyperbolic tangent of x
Returns IEEE 64-bit binary floating point format representation of x
as an int.
Parameters
- x float
-
float value
-
Return Type
(int) x
bit pattern as an int
Returns a string that represents x
as a hexadecimal floating point number.
The returned string will comply to the grammar of HexFloatingPointLiteral
in the Ballerina spec with the following modifications:
- it will have a leading
-
sign if negative - positive infinity will be represented by
Infinity
- negative infinity will be represented by
-Infinity
- NaN will be represented by
NaN
The representation includes0x
for finite numbers.
Parameters
- x float
-
float value
-
Return Type
(string) hexadecimal floating point hex string representation