IeeeFloat::overflow_result ( in src/ieee.rs) returns Status::INEXACT alone on the finite-result path.
IEEE 754-2019 7.4 requires the overflow whenever the largest finite number is exceeded in magnitude by what would have been the rounded floating point result with an unbounded exponent range.
Whether the default result subsequently produced by the selected rounding mode is infinity or the largest finite value does not change whether overflow occurred.
In particular, the specification details overflow for roundTowardZero and roundTowardNegative even with a non inf result.
use rustc_apfloat::ieee::Quad;
use rustc_apfloat::{Float, Round, Status, StatusAnd};
fn main() {
let x = Quad::largest();
let StatusAnd { status, value } = x.mul_r(x, Round::TowardZero);
println!("value : {value:?}");
println!("status: {status:?}");
}
Observed:
value : 1.18973149535723176508575932662800702E+4932(Normal | +[10384593717069655257060992658440191] * 2^16383)
status: Status(INEXACT)
Expected:
value : 1.18973149535723176508575932662800702E+4932(Normal | +[10384593717069655257060992658440191] * 2^16383)
status: Status(OVERFLOW | INEXACT)
This is related to the following LLVM issue: llvm/llvm-project#220018
IeeeFloat::overflow_result( insrc/ieee.rs) returnsStatus::INEXACTalone on the finite-result path.IEEE 754-2019 7.4 requires the overflow whenever the largest finite number is exceeded in magnitude by what would have been the rounded floating point result with an unbounded exponent range.
Whether the default result subsequently produced by the selected rounding mode is infinity or the largest finite value does not change whether overflow occurred.
In particular, the specification details overflow for roundTowardZero and roundTowardNegative even with a non inf result.
Observed:
Expected:
This is related to the following LLVM issue: llvm/llvm-project#220018