Trait m::Float
[−]
[src]
pub trait Float { fn abs(self) -> Self; fn atan(self) -> Self; fn atan2(self, Self) -> Self; fn is_infinite(self) -> bool; fn is_nan(self) -> bool; }
Trait that provides mathematical functions for floating point numbers
Fine print
This trait is meant to be a "closed" extension trait that's not meant to be implemented by downstream users. As such this trait is exempted from semver rules in the context of adding new methods to it. Therefore: if you implement this trait (don't do that), your code may (will!) break during a minor version bump. You have been warned!
Required Methods
fn abs(self) -> Self
Computes the absolute value of self
. Returns NAN
if the number is NAN
.
fn atan(self) -> Self
Computes the arctangent of a number. Return value is in radians in the range [-pi/2, pi/2]
fn atan2(self, Self) -> Self
Computes the four quadrant arctangent of self
(y
) and other
(x
)
x = 0
,y = 0
:0
x >= 0
:arctan(y / x)
->[-pi/2, pi/2]
y >= 0
:arctan(y / x) + pi
->(pi/2, pi]
y < 0
:arctan(y / x) - pi
->(-pi, -pi/2)
fn is_infinite(self) -> bool
Returns true
if this value is positive infinity or negative infinity and false
otherwise.
fn is_nan(self) -> bool
Returns true
if this value is NaN
and false
otherwise.
Implementors
impl Float for f32
impl Float for f64