Skip to main content

FloatExt

Trait FloatExt 

Source
pub trait FloatExt: PrimitiveMath {
    type Type;
    type Size;

Show 22 methods // Required methods fn trunc(self) -> Self::Type; fn fract(self) -> Self::Type; fn abs(self) -> Self::Type; fn round(self) -> Self::Type; fn floor(self) -> Self::Type; fn ceil(self) -> Self::Type; fn signum(self) -> Self::Type; fn clamp(self, min: Self, max: Self) -> Self::Type; fn exp(self) -> Self::Type; fn ln(self) -> Self::Type; fn log10(self) -> Self::Type; fn powi(self, val: i32) -> Self::Type; fn powf(self, val: Self::Type) -> Self::Type; fn sqrt(self) -> Self::Type; fn to_bits(self) -> Self::Size; fn exponent(self) -> u16; fn significand(self) -> Self::Size; fn sin(self) -> Self::Type; fn cos(self) -> Self::Type; fn tan(self) -> Self::Type; fn atan(self) -> Self::Type; fn atan2(self, o: Self) -> Self::Type;
}

Required Associated Types§

Required Methods§

Source

fn trunc(self) -> Self::Type

Source

fn fract(self) -> Self::Type

Source

fn abs(self) -> Self::Type

Source

fn round(self) -> Self::Type

Source

fn floor(self) -> Self::Type

Source

fn ceil(self) -> Self::Type

Source

fn signum(self) -> Self::Type

Source

fn clamp(self, min: Self, max: Self) -> Self::Type

Source

fn exp(self) -> Self::Type

Source

fn ln(self) -> Self::Type

Source

fn log10(self) -> Self::Type

Source

fn powi(self, val: i32) -> Self::Type

Source

fn powf(self, val: Self::Type) -> Self::Type

Source

fn sqrt(self) -> Self::Type

Source

fn to_bits(self) -> Self::Size

Source

fn exponent(self) -> u16

Source

fn significand(self) -> Self::Size

Source

fn sin(self) -> Self::Type

Source

fn cos(self) -> Self::Type

Source

fn tan(self) -> Self::Type

Source

fn atan(self) -> Self::Type

Source

fn atan2(self, o: Self) -> Self::Type

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 FloatExt for f32

Source§

fn exp(self) -> <f32 as FloatExt>::Type

Implementation of Exponential Function from NIST DTMF eq 4.2.19: <https://dlmf.nist.gov/4.2.E19>

Source§

fn ln(self) -> <f32 as FloatExt>::Type

Implementation of Natural Logarithm using NIST DLMF eq 4.6.4: <https://dlmf.nist.gov/4.6.E4>

Source§

fn powi(self, val: i32) -> <f32 as FloatExt>::Type

Naive implementation of integer power fn. Will do something smarter later.

Source§

fn powf(self, a: <f32 as FloatExt>::Type) -> <f32 as FloatExt>::Type

Implementation of general power function using NIST DLMF eq 4.2.26: <https://dlmf.nist.gov/4.2.E26>

Source§

type Type = f32

Source§

type Size = u32

Source§

fn trunc(self) -> f32

Source§

fn fract(self) -> f32

Source§

fn abs(self) -> f32

Source§

fn round(self) -> f32

Source§

fn floor(self) -> f32

Source§

fn ceil(self) -> f32

Source§

fn signum(self) -> f32

Source§

fn clamp(self, min: f32, max: f32) -> <f32 as FloatExt>::Type

Source§

fn log10(self) -> <f32 as FloatExt>::Type

Source§

fn sqrt(self) -> <f32 as FloatExt>::Type

Source§

fn to_bits(self) -> <f32 as FloatExt>::Size

Source§

fn exponent(self) -> u16

Source§

fn significand(self) -> <f32 as FloatExt>::Size

Source§

fn sin(self) -> <f32 as FloatExt>::Type

Source§

fn cos(self) -> <f32 as FloatExt>::Type

Source§

fn tan(self) -> <f32 as FloatExt>::Type

Source§

fn atan(self) -> <f32 as FloatExt>::Type

Source§

fn atan2(self, o: f32) -> <f32 as FloatExt>::Type

Source§

impl FloatExt for f64

Available on non-crate feature std only.
Source§

fn trunc(self) -> f64

Truncate the value Just casts to u64 then back to f64.

Source§

fn abs(self) -> f64

Force the value to be positive by zeroing out the highest sign bit.

Source§

fn exp(self) -> <f64 as FloatExt>::Type

Implementation of Exponential Function from NIST DTMF eq 4.2.19: <https://dlmf.nist.gov/4.2.E19>

Source§

fn ln(self) -> <f64 as FloatExt>::Type

Implementation of Natural Logarithm using NIST DLMF eq 4.6.4: <https://dlmf.nist.gov/4.6.E4>

Source§

fn powf(self, a: <f64 as FloatExt>::Type) -> <f64 as FloatExt>::Type

Implementation of general power function using NIST DLMF eq 4.2.26: <https://dlmf.nist.gov/4.2.E26>

Source§

fn powi(self, val: i32) -> <f64 as FloatExt>::Type

Naive implementation of integer power fn. Will do something smarter later.

Source§

type Type = f64

Source§

type Size = u64

Source§

fn fract(self) -> f64

Source§

fn round(self) -> f64

Source§

fn floor(self) -> f64

Source§

fn ceil(self) -> f64

Source§

fn signum(self) -> f64

Source§

fn clamp(self, min: f64, max: f64) -> <f64 as FloatExt>::Type

Source§

fn log10(self) -> <f64 as FloatExt>::Type

Source§

fn sqrt(self) -> <f64 as FloatExt>::Type

Source§

fn to_bits(self) -> <f64 as FloatExt>::Size

Source§

fn exponent(self) -> u16

Source§

fn significand(self) -> <f64 as FloatExt>::Size

Source§

fn sin(self) -> <f64 as FloatExt>::Type

Source§

fn cos(self) -> <f64 as FloatExt>::Type

Source§

fn tan(self) -> <f64 as FloatExt>::Type

Source§

fn atan(self) -> <f64 as FloatExt>::Type

Source§

fn atan2(self, _o: f64) -> <f64 as FloatExt>::Type

Implementors§