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;
    fn sqrt(self) -> Self;
}

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

Computes the absolute value of self. Returns NAN if the number is NAN.

Computes the arctangent of a number. Return value is in radians in the range [-pi/2, pi/2]

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)

Returns true if this value is positive infinity or negative infinity and false otherwise.

Returns true if this value is NaN and false otherwise.

Takes the square root of a number

Returns NaN if self is a negative number

Implementors