pub trait Round: Copy {
type Reverse: Round;
const IS_ROUND_TOWARD_NEGATIVE: bool;
// Required method
fn round_low_part<F: FnOnce() -> Ordering>(
integer: &IBig,
low_sign: Sign,
low_half_test: F,
) -> Rounding;
// Provided methods
fn round_fract<const B: Word>(
integer: &IBig,
fract: IBig,
precision: usize,
) -> Rounding { ... }
fn round_ratio(integer: &IBig, num: IBig, den: &IBig) -> Rounding { ... }
}Expand description
A trait describing the rounding strategy
Required Associated Constants§
Sourceconst IS_ROUND_TOWARD_NEGATIVE: bool
const IS_ROUND_TOWARD_NEGATIVE: bool
Whether this mode rounds toward negative infinity (IEEE roundTowardNegative).
Used to determine the sign of a zero produced by exact cancellation: per IEEE 754,
x + (-x) yields -0 only under roundTowardNegative, +0 otherwise.
Required Associated Types§
Required Methods§
Sourcefn round_low_part<F: FnOnce() -> Ordering>(
integer: &IBig,
low_sign: Sign,
low_half_test: F,
) -> Rounding
fn round_low_part<F: FnOnce() -> Ordering>( integer: &IBig, low_sign: Sign, low_half_test: F, ) -> Rounding
Calculate the rounding of the number (integer + rem), assuming rem != 0 and |rem| < 1.
low_half_test should tell |rem|.cmp(0.5)
Implementations must decide from the sign of integer alone (plus, when
low_half_test returns Equal, its parity via bit(0)) — some callers
(e.g. the remainder kernel) pass a small stand-in carrying only those bits
of a much larger integer.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".