Skip to main content

Module float

Module float 

Source
Expand description

Methods from the Float trait, exposed as free functions.

Functions§

abs
Computes the absolute value of a number.
abs_sub
The positive difference of two numbers.
acos
Computes the arccosine of a number.
acosh
Inverse hyperbolic cosine function.
asin
Computes the arcsine of a number.
asinh
Inverse hyperbolic sine function.
atan
Computes the arctangent of a number.
atan2
Computes the four quadrant arctangent of two numbers.
atanh
Inverse hyperbolic tangent function.
cbrt
Takes the cubic root of a number.
ceil
Returns the smallest integer greater than or equal to a number.
classify
Returns the floating point category of the number.
cos
Computes the cosine of a number (in radians).
cosh
Hyperbolic cosine function.
epsilon
Returns epsilon, a small positive value.
exp
Returns e^x, (the exponential function).
exp2
Returns 2^x.
exp_m1
Returns e^(self) - 1 in a way that is accurate even if the number is close to zero.
floor
Returns the largest integer less than or equal to a number.
fract
Returns the fractional part of a number.
hypot
Computes the length of the hypotenuse of a right-angle triangle given its legs’ lengths.
infinity
Returns the infinite value.
integer_decode
Returns the mantissa, base 2 exponent, and sign as integers, respectively.
is_finite
Returns true if this number is neither infinite nor NaN.
is_infinite
Returns true if this value is positive or negative infinity and false otherwise.
is_nan
Returns true if this value is NaN and false otherwise.
is_normal
Returns true if the number is neither zero, infinite, subnormal, or NaN.
is_sign_negative
Returns true if the input is negative.
is_sign_positive
Returns true if the input is positive.
ln
Returns the natural logarithm of the number.
ln_1p
Returns ln(1+n) (natural logarithm) more accurately than if the operations were performed separately.
log
Returns the logarithm of the number with respect to an arbitrary base.
log2
Returns the base 2 logarithm of the number.
log10
Returns the base 10 logarithm of the number.
max
Returns the maximum of the two numbers.
max_value
Returns the largest finite value that this type can represent.
min
Returns the minimum of the two numbers.
min_positive_value
Returns the smallest positive, normalized value that this type can represent.
min_value
Returns the smallest finite value that this type can represent.
mul_add
Fused multiply-add.
nan
Returns the NaN value.
neg_infinity
Returns the negative infinite value.
neg_zero
Returns -0.0.
powf
Raises a number to a floating point power.
powi
Raises a number to an integer power.
recip
Takes the reciprocal (inverse) of a number, 1/x.
round
Returns the nearest integer to a number. Rounds half-way cases away from 0.0.
signum
Returns a number that represents the sign of the input.
sin
Computes the sine of a number (in radians).
sin_cos
Simultaneously computes the sine and cosine of a number x. Returns (sin(x), cos(x)).
sinh
Hyperbolic sine function.
sqrt
Takes the square root of a number.
tan
Computes the tangent of a number (in radians).
tanh
Hyperbolic tangent function.
to_degrees
Converts radians to degrees.
to_radians
Converts degrees to radians.
trunc
Returns the integer part of a number.