core::num::impl f32
On this page
57absacosacoshasinasinhatanatan2atanhcbrtceilclampcopysigncoscoshdiv_euclidexpexp2exp_m1floorfractfrom_bitshypotis_closeis_finiteis_infiniteis_nanis_normalis_sign_negativeis_sign_positivelerplnln_1ploglog10log2maxminmul_addnext_afternext_downnext_uppowpowireciprem_euclidroundsignumsinsinhsqrttantanhto_bitsto_degreesto_radianstotal_cmptrunc
impl f32
Sourcepub const fn is_close(§self, other: f32, rel: f32 = 9.5367431640625e-7, abs: f32 = 0.0, equal_nan: bool = false) -> bool f64::is_closeforf32; the defaultrelis 2^-20 (eight units in the last place), as 1e-9 is belowf32's precision.nabiassert((0.1f32 + 0.2f32).is_close(0.3f32));The gap between 1.0 and the next larger value.
The largest value.
The smallest value.
The smallest positive normal value.
Not a number: the quiet NaN with the sign bit clear on every target.
Positive infinity.
Negative infinity.
Pi.
tau = 2 pi.
Euler's number e.
pi/2.
pi/4.
1/pi.
sqrt(2).
1/sqrt(2).
ln 2.
ln 10.
log2(e).
log10(e).
The square root; NaN for a negative value (as
√self).The IEEE 754 total order:
-NaN < -inf < .. < -0 < +0 < .. < inf < NaN. Sorting by it never fails:xs.sort_by(f32::total_cmp).The IEEE 754 bit pattern.
The f32 with the IEEE 754 bit pattern
bits.truefor NaN.trueforinfor-inf.trueunless infinite or NaN.Neither zero, subnormal, infinite nor NaN.
truewhen the sign bit is clear (0.0,+inf, a positive NaN).truewhen the sign bit is set (-0.0,-inf, a negative NaN).Largest integer
<= self.Smallest integer
>= self.Nearest integer, halves away from zero.
Integer part (toward zero).
The magnitude (sign bit cleared).
Cube root.
e^self.2^self.e^self - 1, exact near zero.Natural logarithm.
ln(1 + self), exact near zero.Base-2 logarithm.
Base-10 logarithm.
Sine of
selfin radians.Cosine of
selfin radians.Tangent of
selfin radians.Arcsine in radians, in
[-pi/2, pi/2]; NaN outside[-1, 1].Arccosine in radians, in
[0, pi]; NaN outside[-1, 1].Arctangent in radians, in
[-pi/2, pi/2].Hyperbolic sine.
Hyperbolic cosine.
Hyperbolic tangent.
Inverse hyperbolic sine.
Inverse hyperbolic cosine; NaN below
1.Inverse hyperbolic tangent; NaN outside
[-1, 1].self - self.trunc().-1.0/1.0by sign; zeros and NaN are returned as they are.1.0 / self.Radians to degrees.
Degrees to radians.
ln(self) / ln(base).self^exp(powfin Rust).Angle of the point
(other, self).sqrt(self^2 + other^2)without overflow.self's magnitude withsign's sign.The smaller; a NaN operand loses to a number.
The larger; a NaN operand loses to a number.
selfto an integer power, by repeated multiplication: may round differently frompow(n as f32).self * a + bwith one rounding.selflimited tolo..=hi; NaN stays NaN. Panics iflo > hi.The quotient rounded so that
rem_euclidis never negative.The remainder in
[0, |rhs|); NaN whenrhsis 0.selfatt = 0,otheratt = 1, a straight line between and past them: exact at both ends and monotonic int(C++std::lerp).The next representable value after
selfin the direction oftoward(Cnextafter);towarditself when equal, NaN if either is.The least value greater than
self; infinity and NaN stay.The greatest value less than
self; -infinity and NaN stay.