Trait soroban_fixed_point_math::FixedPoint
source · pub trait FixedPoint: Sized {
// Required methods
fn fixed_mul_floor(self, y: Self, denominator: Self) -> Option<Self>;
fn fixed_mul_ceil(self, y: Self, denominator: Self) -> Option<Self>;
fn fixed_div_floor(self, y: Self, denominator: Self) -> Option<Self>;
fn fixed_div_ceil(self, y: Self, denominator: Self) -> Option<Self>;
}Expand description
Fixed point trait for computing fixed point calculations with native rust types.
Required Methods§
sourcefn fixed_mul_floor(self, y: Self, denominator: Self) -> Option<Self>
fn fixed_mul_floor(self, y: Self, denominator: Self) -> Option<Self>
Safely calculates floor(x * y / denominator). Returns None if a phantom overflow occurs or if the denominator is 0.
sourcefn fixed_mul_ceil(self, y: Self, denominator: Self) -> Option<Self>
fn fixed_mul_ceil(self, y: Self, denominator: Self) -> Option<Self>
Safely calculates ceil(x * y / denominator). Returns None if a phantom overflow occurs or if the denominator is 0.
sourcefn fixed_div_floor(self, y: Self, denominator: Self) -> Option<Self>
fn fixed_div_floor(self, y: Self, denominator: Self) -> Option<Self>
Safely calculates floor(x * denominator / y). Returns None if a phantom overflow occurs or if the denominator is 0.
sourcefn fixed_div_ceil(self, y: Self, denominator: Self) -> Option<Self>
fn fixed_div_ceil(self, y: Self, denominator: Self) -> Option<Self>
Safely calculates ceil(x * denominator / y). Returns None if a phantom overflow occurs or if the denominator is 0.
Object Safety§
This trait is not object safe.