mirror of
https://github.com/ziglang/zig.git
synced 2026-01-22 07:15:25 +00:00
fix invalid const expr eval for negative floats
This commit is contained in:
parent
675de74412
commit
2e092e08f4
@ -112,7 +112,7 @@ void bignum_negate(BigNum *dest, BigNum *op) {
|
||||
dest->kind = op->kind;
|
||||
|
||||
if (dest->kind == BigNumKindFloat) {
|
||||
dest->data.x_float = -dest->data.x_float;
|
||||
dest->data.x_float = -op->data.x_float;
|
||||
} else {
|
||||
dest->data.x_uint = op->data.x_uint;
|
||||
dest->is_negative = !op->is_negative;
|
||||
|
||||
@ -1497,10 +1497,10 @@ export fn main(argc: c_int, argv: &&u8) -> c_int {
|
||||
const x: f64 = small;
|
||||
const y = i32(x);
|
||||
const z = f64(y);
|
||||
printf(c"%.2f\n%d\n%.2f\n", x, y, z);
|
||||
printf(c"%.2f\n%d\n%.2f\n%.2f\n", x, y, z, f64(-0.4));
|
||||
return 0;
|
||||
}
|
||||
)SOURCE", "3.25\n3\n3.00\n");
|
||||
)SOURCE", "3.25\n3\n3.00\n-0.40\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user