[][src]Trait micromath::F32Ext

pub trait F32Ext: Sized {
    fn abs(self) -> f32;
fn atan(self) -> f32;
fn atan_norm(self) -> f32;
fn atan2(self, other: f32) -> f32;
fn atan2_norm(self, other: f32) -> f32;
fn ceil(self) -> f32;
fn cos(self) -> f32;
fn floor(self) -> f32;
fn inv(self) -> f32;
fn invsqrt(self) -> f32;
fn sin(self) -> f32;
fn sqrt(self) -> f32;
fn tan(self) -> f32;
fn trunc(self) -> f32;
fn round(self) -> f32;
fn fract(self) -> f32;
fn copysign(self, sign: f32) -> f32;
fn ln(self) -> f32;
fn exp(self) -> f32;
fn log(self, base: f32) -> f32;
fn log2(self) -> f32;
fn log10(self) -> f32;
fn powf(self, n: f32) -> f32; }

f32 extension providing various arithmetic approximations and polyfills for std functionality.

Required methods

fn abs(self) -> f32

Compute absolute value with a constant-time, data-independent implementation.

fn atan(self) -> f32

Approximates atan(x) in radians with a maximum error of 0.002.

fn atan_norm(self) -> f32

Approximates atan(x) normalized to the [−1,1] range with a maximum error of 0.1620 degrees.

fn atan2(self, other: f32) -> f32

Approximates the four quadrant arctangent atan2(x) in radians, with a maximum error of 0.002.

fn atan2_norm(self, other: f32) -> f32

Approximates the four quadrant arctangent. Normalized to the [0,4) range with a maximum error of 0.1620 degrees.

fn ceil(self) -> f32

Approximates floating point ceiling.

fn cos(self) -> f32

Approximates cosine in radians with a maximum error of 0.002.

fn floor(self) -> f32

Approximates floating point floor.

fn inv(self) -> f32

Approximates 1/x with an average deviation of ~8%.

fn invsqrt(self) -> f32

Approximates inverse square root with an average deviation of ~5%.

fn sin(self) -> f32

Approximates sine in radians with a maximum error of 0.002.

fn sqrt(self) -> f32

Approximates square root with an average deviation of ~5%.

fn tan(self) -> f32

Approximates tan(x) in radians with a maximum error of 0.6.

fn trunc(self) -> f32

retrieves whole number part of floating point with sign

fn round(self) -> f32

rounds the number part of floating point with sign

fn fract(self) -> f32

retrieves the fractional part of floating point with sign

fn copysign(self, sign: f32) -> f32

copies the sign from one number to another and returns it.

fn ln(self) -> f32

approximates ln(x)

fn exp(self) -> f32

approximates e^x

fn log(self, base: f32) -> f32

approximates log to an arbitrary base

fn log2(self) -> f32

approximates log2

fn log10(self) -> f32

approximates log10

fn powf(self, n: f32) -> f32

approximates self^n

Loading content...

Implementors

impl F32Ext for f32[src]

Loading content...