Functions
abs | I Returns the IEEE absolute value of a float value. |
acos | I Returns the arccosine of a float value. |
asin | I Returns the arcsine of a float value. |
atan | I Returns the arctangent of a float value. |
atan2 | I Performs the 2-argument arctangent operation. |
cbrt | I Returns the cube root of a float value. |
ceiling | I Rounds a float up to the closest integral value. |
cos | I Returns the cosine of a float value. |
cosh | I Returns the hyperbolic cosine of a float value. |
exp | I Raises Euler's number to a power. |
floor | I Rounds a float down to the closest integral value. |
fromBitsInt | I Returns the float that is represented in IEEE 64-bit floating point by an int. |
fromHexString | I Return the float value represented by a string. |
fromString | I Returns the float value represented by a string. |
isFinite | I Tests whether a float is finite. |
isInfinite | I Tests whether a float is infinite. |
isNaN | I Tests whether a float is NaN. |
log | I Returns the natural logarithm of a float value. |
log10 | I Returns the base 10 logarithm of a float value. |
max | I Returns the maximum of zero or more float values. |
min | I Returns the minimum of zero or more float values. |
pow | I Raises one float value to the power of another float values. |
round | I Rounds a float value to the closest integral value. |
sin | I Returns the sine of a float value. |
sinh | I Returns the hyperbolic sine of a float value. |
sqrt | I Returns the square root of a float value. |
sum | I Returns the sum of zero or more float values. |
tan | I Returns the tangent of a float value. |
tanh | I Returns the hyperbolic tangent of a float value. |
toBitsInt | I Returns IEEE 64-bit binary floating point format representation of a float value as an int. |
toHexString | I Returns a string that represents a float value as a hexadecimal floating point number. |
abs
Returns the IEEE absolute value of a float value.
Parameters
- x float
float value to operate on
acos
Returns the arccosine of a float value.
Corresponds to IEEE acos operation.
Parameters
- x float
float value to operate on
asin
Returns the arcsine of a float value.
Corresponds to IEEE asin operation.
Parameters
- x float
float value to operate on
atan
Returns the arctangent of a float value.
Corresponds to IEEE atan operation.
Parameters
- x float
float value to operate on
atan2
Performs the 2-argument arctangent operation.
Corresponds IEEE atan2(y, x) operation.
Return Type
(float)the angle in radians from the positive x-axis to the point
whose Cartesian coordinates are (x, y)
cbrt
Returns the cube root of a float value.
Corresponds to IEEE rootn(x, 3) operation.
Parameters
- x float
float value to operate on
ceiling
Rounds a float up to the closest integral value.
Parameters
- x float
float value to operate on
Return Type
(float)smallest (closest to -∞) decimal value not less than parameter x
that is a mathematical integer
cos
Returns the cosine of a float value.
Corresponds to IEEE cos operation.
Parameters
- x float
float value, specifying an angle in radians
cosh
Returns the hyperbolic cosine of a float value.
Corresponds to IEEE cosh operation.
Parameters
- x float
float value to operate on
exp
Raises Euler's number to a power.
Corresponds to IEEE exp operation.
Parameters
- x float
float value to operate on
floor
Rounds a float down to the closest integral value.
Parameters
- x float
float value to operate on
Return Type
(float)largest (closest to +∞) float value not greater than parameter x
that is a mathematical integer
fromBitsInt
Returns the float that is represented in IEEE 64-bit floating point by an int.
All bit patterns that IEEE defines to be NaNs will all be mapped to the single float NaN value.
Parameters
- x int
int value
fromHexString
Return the float value represented by a string.
parameter 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
fromString
Returns the float value represented by a string.
parameter 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 function value:toString
applied to an float
.
Parameters
- s string
string representation of a float
isFinite
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
isInfinite
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
isNaN
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
log
Returns the natural logarithm of a float value.
Corresponds to IEEE log operation.
Parameters
- x float
float value to operate on
log10
Returns the base 10 logarithm of a float value.
Corresponds to IEEE log10 operation.
Parameters
- x float
float value to operate on
max
Returns the maximum of zero or more float values.
Result is -∞ if no args NaN if any arg is NaN
Parameters
- xs float...
float values to operate on
min
Returns the minimum of zero or more float values.
Result is +∞ if no args Result is NaN if any arg is NaN
Parameters
- xs float...
float values to operate on
pow
Raises one float value to the power of another float values.
Corresponds to IEEE pow(x, y) operation.
round
Rounds a float value to the closest integral value.
Returns the float value that is a mathematical integer and closest to parameter x
.
If there are two such values, 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
float value to operate on
sin
Returns the sine of a float value.
Corresponds to IEEE sin operation.
Parameters
- x float
float value, specifying an angle in radians
sinh
Returns the hyperbolic sine of a float value.
Corresponds to IEEE sinh operation.
Parameters
- x float
float value to operate on
sqrt
Returns the square root of a float value.
Corresponds to IEEE squareRoot operation.
Parameters
- x float
float value to operate on
sum
Returns the sum of zero or more float values.
Result is NaN if any arg is NaN
Parameters
- xs float...
float values to sum
tan
Returns the tangent of a float value.
Corresponds to IEEE tan operation
Parameters
- x float
float value, specifying an angle in radians
tanh
Returns the hyperbolic tangent of a float value.
Corresponds to IEEE tanh operation.
Parameters
- x float
float value to operate on
toBitsInt
Returns IEEE 64-bit binary floating point format representation of a float value as an int.
Parameters
- x float
float value
toHexString
Returns a string that represents a float value 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 includes 0x
for finite numbers.
Parameters
- x float
float value