Constants and functions supporting the Float type defined in ceylon.language.

See also Float
Values
eSource Codeshared Float e

The Float which best approximates the mathematical constant 𝑒, the base of the natural logarithm.

See also exp(), log()
piSource Codeshared Float pi

The Float which best approximates the mathematical constant π, the ratio of the circumference of a circle to its diameter.

Functions
acosSource Codeshared Float acos(Float num)

The arc cosine of the given number.

  • acos(x) for any x < -1 is undefined,
  • acos(x) for any x > 1 is undefined,
  • acos(undefined) isundefined`.
asinSource Codeshared Float asin(Float num)

The arc sine of the given number.

  • asin(x) for any x < -1 is undefined,
  • asin(-0) is -0,
  • asin(+0) is +0,
  • asin(x) for any x > 1 is undefined,
  • asin(undefined) isundefined`.
atanSource Codeshared Float atan(Float num)

The arc tangent of the given number.

  • atan(-0) is -0,
  • atan(+0) is +0,
  • atan(undefined) is undefined.
atan2Source Codeshared Float atan2(Float y, Float x)

The angle from converting rectangular coordinates x and y to polar coordinates.

Special cases:

y x atan2(y,x)
undefined any value undefined
any value undefined undefined
+0 > 0 +0
> 0 and not +infinity +infinity +0
-0 > 0 -0
< 0 and not -infinity +infinity -0
+0 < 0 π
> 0 and not +infinity -infinity π
-0 < 0
< 0 and not -infinity -infinity
> 0 +0 or -0 π/2
+infinity not +infinity or -infinity π/2
< 0 +0 or -0 -π/2
-infinity not +infinity or -infinity -π/2
+infinity +infinity π/4
+infinity -infinity 3π/4
-infinity +infinity -π/4
-infinity -infinity -3π/4
cbrtSource Codeshared Float cbrt(Float num)

The cube root of the given number. This method may be faster and/or more accurate than num^(1.0/3.0).

  • cbrt(-infinity) is -infinity,
  • cbrt(-0) is -0,
  • cbrt(+0) is +0,
  • cbrt(+infinity) is +infinity,
  • cbrt(undefined) is undefined.
ceilingSource Codeshared Float ceiling(Float num)

The smallest value that is greater than or equal to the argument and equal to an integer.

  • ceiling(-infinity) is -infinity,
  • ceiling(x) for -1.0 < x < -0 is -0,
  • ceiling(-0) is -0,
  • ceiling(+0) is +0,
  • ceiling(+infinity) is +infinity,
  • ceiling(undefined) is undefined.
See also floor()
cosSource Codeshared Float cos(Float num)

The cosine of the given angle specified in radians.

  • cos(-infinity) is undefined,
  • cos(+infinity) is undefined,
  • cos(undefined) is undefined.
coshSource Codeshared Float cosh(Float num)

The hyperbolic cosine of the given angle specified in radians.

  • cosh(0) is 1.
  • cosh(-infinity) is +infinity,
  • cosh(+infinity) is +infinity,
  • cosh(undefined) is undefined.
expSource Codeshared Float exp(Float num)

𝑒 raised to the power of the argument.

  • exp(-infinity) is +0,
  • exp(+infinity) is +infinity,
  • exp(undefined) is undefined.
See also expm1()
expm1Source Codeshared Float expm1(Float num)

A more accurate computation of exp(x)-1.0 for x near zero.

floorSource Codeshared Float floor(Float num)

The largest value that is less than or equal to the argument and equal to an integer.

  • floor(-infinity) is -infinity,
  • floor(-0) is -0,
  • floor(+0) is +0,
  • floor(+infinity) is +infinity,
  • floor(undefined) is undefined.
See also ceiling()
halfEvenSource Codeshared Float halfEven(Float num)

The closest value to the argument that is equal to a mathematical integer, with even values preferred in the event of a tie (half even rounding).

  • halfEven(-infinity) is -infinity
  • halfEven(-0) is -0
  • halfEven(+0) is +0
  • halfEven(+infinity) is +infinity
  • halfEven(undefined) is undefined
See also floor()
hypotSource Codeshared Float hypot(Float x, Float y)

Returns the length of the hypotenuse of a right angle triangle with other sides having lengths x and y. This method may be more accurate than computing sqrt(x^2 + x^2) directly.

  • hypot(x,y) where x and/or y is +infinity or -infinity, is +infinity,
  • hypot(x,y), where x and/or y is undefined, is undefined.
largestSource Codeshared Float largest(Float x, Float y)

The larger of the two arguments.

  • largest(-1,+0) is +0
  • largest(undefined, x) is undefined
  • largest(x, x) is x
  • largest(+infinity,x) is+infinity`
  • largest(-infinity,x) isx`
See also smallest()
logSource Codeshared Float log(Float num)

The natural logarithm (base 𝑒) of the argument.

  • log(x) for any x < 0 is undefined,
  • log(+0) and log(-0) is -infinity,
  • log(+infinity) is +infinity,
  • log(undefined) is undefined.
See also log10(), log1p()
log10Source Codeshared Float log10(Float num)

The base 10 logarithm of the argument.

  • log10(x) for any x < 0 is undefined,
  • log10(-0) and log10(+0) is -infinity,
  • log10(+infinity) is +infinity,
  • log10(undefined) is undefined.
See also log()
log1pSource Codeshared Float log1p(Float num)

A more accurate computation of log(1.0+x) for x near zero.

maxSource Codeshared Float|Absent max<Absent>(Iterable<Float,Absent> values)
given Absent satisfies Null

The largest Float in the given stream, or null if the stream is empty.

minSource Codeshared Float|Absent min<Absent>(Iterable<Float,Absent> values)
given Absent satisfies Null

The smallest Float in the given stream, or null if the stream is empty.

productSource Codeshared Float product({Float*} values)

The product of the Floats in the given stream, or 1.0 if the stream is empty.

randomSource Codeshared Float random()

A number greater than or equal to positive zero and less than 1.0, chosen pseudorandomly and (approximately) uniformly distributed.

scalbSource Codeshared Float scalb(Float x, Integer n)

The value of x × 2ⁿ, calculated exactly for reasonable values of n.

sinSource Codeshared Float sin(Float num)

The sine of the given angle specified in radians.

  • sin(-0) is -0,
  • sin(+0) is +0,
  • sin(-infinity) is undefined,
  • sin(+infinity) is undefined,
  • sin(undefined) is undefined.
sinhSource Codeshared Float sinh(Float num)

The hyperbolic sine of the given angle specified in radians.

  • sinh(-0) is -0,
  • sinh(+0) is +0,
  • sin(-infinity) is -infinity,
  • sin(+infinity) is +infinity,
  • sin(undefined) is undefined.
smallestSource Codeshared Float smallest(Float x, Float y)

The smaller of the two arguments.

  • smallest(-1,+0) is -0
  • smallest(undefined, x) is undefined
  • smallest(x, x) is x
  • smallest(+infinity,x) isx`
  • smallest(-infinity,x) is-infinity`
See also largest()
sqrtSource Codeshared Float sqrt(Float num)

The positive square root of the given number. This method may be faster and/or more accurate than num^0.5.

  • sqrt(x) for any x < 0 is undefined,
  • sqrt(-0) is -0,
  • sqrt(+0) is+0`,
  • sqrt(+infinity) is +infinity,
  • sqrt(undefined) is undefined.
sumSource Codeshared Float sum({Float*} values)

The sum of the Floats in the given stream, or 0.0 if the stream is empty.

tanSource Codeshared Float tan(Float num)

The tangent of the given angle specified in radians.

  • tan(-infinity) is undefined,
  • tan(-0) is -0,
  • tan(+0) is +0,
  • tan(+infinity) is undefined,
  • tan(undefined) is undefined.
tanhSource Codeshared Float tanh(Float num)

The hyperbolic tangent of the given angle specified in radians.

  • tanh(+infinity) is +1,
  • tanh(-infinity) is -1,
  • tanh(-0) is -0,
  • tanh(+0) is +0,
  • tanh(undefined) is undefined.
toDegreesSource Codeshared Float toDegrees(Float num)

The given angle (in radians) converted to degrees.

See also toRadians()
toRadiansSource Codeshared Float toRadians(Float num)

The given angle (in degrees) converted to radians.

See also toDegrees()