authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2016-01-31 21:50:41-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2016-01-31 21:50:41-07:00
log2e092e08f4fefa3fcd05484a755db5f5eef8e9cd
tree2ce0b959b66f4a7475531615c00c6fef0a2a27b1
parent675de74412e6006ee270fdd2a3b3e20727328af0

fix invalid const expr eval for negative floats


2 files changed, 3 insertions(+), 3 deletions(-)

src/bignum.cpp+1-1
...@@ -112,7 +112,7 @@ void bignum_negate(BigNum *dest, BigNum *op) {...@@ -112,7 +112,7 @@ void bignum_negate(BigNum *dest, BigNum *op) {
112 dest->kind = op->kind;112 dest->kind = op->kind;
113113
114 if (dest->kind == BigNumKindFloat) {114 if (dest->kind == BigNumKindFloat) {
115 dest->data.x_float = -dest->data.x_float;115 dest->data.x_float = -op->data.x_float;
116 } else {116 } else {
117 dest->data.x_uint = op->data.x_uint;117 dest->data.x_uint = op->data.x_uint;
118 dest->is_negative = !op->is_negative;118 dest->is_negative = !op->is_negative;
test/run_tests.cpp+2-2
...@@ -1497,10 +1497,10 @@ export fn main(argc: c_int, argv: &&u8) -> c_int {...@@ -1497,10 +1497,10 @@ export fn main(argc: c_int, argv: &&u8) -> c_int {
1497 const x: f64 = small;1497 const x: f64 = small;
1498 const y = i32(x);1498 const y = i32(x);
1499 const z = f64(y);1499 const z = f64(y);
1500 printf(c"%.2f\n%d\n%.2f\n", x, y, z);1500 printf(c"%.2f\n%d\n%.2f\n%.2f\n", x, y, z, f64(-0.4));
1501 return 0;1501 return 0;
1502}1502}
1503 )SOURCE", "3.25\n3\n3.00\n");1503 )SOURCE", "3.25\n3\n3.00\n-0.40\n");
1504}1504}
15051505
15061506