Struct libm::Libm

source · []
pub struct Libm<T>(_);
Expand description

Generic helper for libm functions, abstracting over f32 and f64.

Type Parameter:

  • T: Either f32 or f64

Examples

use libm::{self, Libm};

const PI_F32: f32 = 3.1415927410e+00;
const PI_F64: f64 = 3.1415926535897931160e+00;

assert!(Libm::<f32>::cos(0.0f32) == libm::cosf(0.0));
assert!(Libm::<f32>::sin(PI_F32) == libm::sinf(PI_F32));

assert!(Libm::<f64>::cos(0.0f64) == libm::cos(0.0));
assert!(Libm::<f64>::sin(PI_F64) == libm::sin(PI_F64));

Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.