FloatingPoint

Trait FloatingPoint 

Source
pub trait FloatingPoint:
    Numeric
    + Neg<Output = Self>
    + Add<Self, Output = Self>
    + AddAssign<Self>
    + Div<Self, Output = Self>
    + DivAssign<Self>
    + Mul<Self, Output = Self>
    + MulAssign<Self>
    + Rem<Self, Output = Self>
    + RemAssign<Self>
    + Sub<Self, Output = Self>
    + SubAssign<Self> {
    // Required methods
    fn powi(self, power: i32) -> Self;
    fn round(self) -> Self;
    fn fract(self) -> Self;
    fn rem_euclid(self, rhs: Self) -> Self;
    fn sqrt(self) -> Self;
    fn ln(self) -> Self;
    fn abs(self) -> Self;
    fn floor(self) -> Self;
    fn to_bit_string(&self) -> String;
}
Expand description

A trait shared by all the floating point types.

Required Methods§

Source

fn powi(self, power: i32) -> Self

Raises a float to an integer power.

Source

fn round(self) -> Self

Rounds the float to the closest integer.

Source

fn fract(self) -> Self

Keeps the fractional part of the number.

Source

fn rem_euclid(self, rhs: Self) -> Self

Remainder of the euclidean division.

Source

fn sqrt(self) -> Self

Returns the square root of the input float.

Source

fn ln(self) -> Self

Returns the natural logarithm of the input float.

Source

fn abs(self) -> Self

Returns the absolute value of the input float.

Source

fn floor(self) -> Self

Returns the floor value of the input float.

Source

fn to_bit_string(&self) -> String

Returns a bit representation of the float, with the sign, exponent, and mantissa bits separated by whitespaces for increased readability.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl FloatingPoint for f32

Source§

fn powi(self, power: i32) -> Self

Source§

fn round(self) -> Self

Source§

fn fract(self) -> Self

Source§

fn rem_euclid(self, rhs: Self) -> Self

Source§

fn sqrt(self) -> Self

Source§

fn ln(self) -> Self

Source§

fn abs(self) -> Self

Source§

fn floor(self) -> Self

Source§

fn to_bit_string(&self) -> String

Source§

impl FloatingPoint for f64

Source§

fn powi(self, power: i32) -> Self

Source§

fn round(self) -> Self

Source§

fn fract(self) -> Self

Source§

fn rem_euclid(self, rhs: Self) -> Self

Source§

fn sqrt(self) -> Self

Source§

fn ln(self) -> Self

Source§

fn abs(self) -> Self

Source§

fn floor(self) -> Self

Source§

fn to_bit_string(&self) -> String

Implementors§