-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
rust-lang/rustc_apfloat
#1Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)A-floating-pointArea: Floating point numbers and arithmeticArea: Floating point numbers and arithmeticA-mir-optArea: MIR optimizationsArea: MIR optimizationsC-bugCategory: This is a bug.Category: This is a bug.
Description
With this code:
#![feature(const_fn_floating_point_arithmetic)]
const fn f(one: f64) -> f64 {
(-1.0) % one
}
const RESULT_CT : f64 = f(1.0);
fn main() {
let black_box_one = (std::env::args().len()) as f64;
let result_rt = f(black_box_one);
assert_eq!(RESULT_CT.is_sign_negative(), result_rt.is_sign_negative());
}
The assertion fails: compile-time evaluation gives 0.0 while runtime evaluation gives -0.0.
This is probably relevant to tracking issue #57241.
scottmcm
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)A-floating-pointArea: Floating point numbers and arithmeticArea: Floating point numbers and arithmeticA-mir-optArea: MIR optimizationsArea: MIR optimizationsC-bugCategory: This is a bug.Category: This is a bug.