Struct lyon::tessellation::fixed::Fp64
[−]
[src]
pub struct Fp64<F = _24> { /* fields omitted */ }
A 64 bits fixed point number. The size of the fractional is defined by the type parameter F.
Methods
impl<F> Fp64<F> where F: FractionalBits
fn one() -> Fp64<F>
fn from_i64(val: i64) -> Fp64<F>
fn truncate_to_i64(self) -> i64
Convert to an i64, truncating the fractional part
fn mul_div(self, m: Fp64<F>, d: Fp64<F>) -> Fp64<F>
Computes the self * m / d in one go, avoid the precision loss from shifting bits back and forth.
fn to_fp32<NewF>(self) -> Fp32<NewF> where NewF: FractionalBits
Casts into a 32 bits fixed point number.
impl<F> Fp64<F> where F: FractionalBits
fn raw(self) -> i64
Returns the internal representation.
This internal represenataion can be used for computations to avoid bit-shifting between each operation. The number of divisions should be equal to the number of multiplications performed in order to balance out the bit shifts that were skipped.
fn from_raw(bits: i64) -> Fp64<F>
fn zero() -> Fp64<F>
fn is_zero(self) -> bool
fn epsilon() -> Fp64<F>
Smallest increment that can be reresented with this type.
fn from_f32(val: f32) -> Fp64<F>
Converts from a 32 bits floating point value.
fn to_f32(self) -> f32
Converts to a 32 bits floating point value.
fn from_f64(val: f64) -> Fp64<F>
Converts from a 64 bits floating point value.
fn to_f64(self) -> f64
Converts to a 64 bits floating point value.
fn sign(self) -> i64
Returns 1 if the number of positive, -1 if it is negative.
fn rem(self, other: Fp64<F>) -> Fp64<F>
Returns the result of self % other.
fn min(self, other: Fp64<F>) -> Fp64<F>
Returns the lowest of the two values.
fn max(self, other: Fp64<F>) -> Fp64<F>
Returns the highest of the two values.
fn min_max(self, other: Fp64<F>) -> (Fp64<F>, Fp64<F>)
Returns the lowest and highest of the two values in order.
fn abs(self) -> Fp64<F>
Returns the absolute value of this number.
fn to_fixed<NewF>(self) -> Fp64<NewF> where NewF: FractionalBits
Returns the same number with a different fractional precision.