| author | |
| committer | |
| log | 06ae13fe359dba7675a02716fd8edbcfbd7751d9 |
| tree | 3808239b1f1e22a8e8a9a8a7a4225abae0696765 |
| parent | dafbc6eb2524d1e8276ceec2cf26cb1d4982e2ad |
Fixes #10592.2 files changed, 7 insertions(+), 1 deletions(-)
src/stage1/bigint.cpp+1-1| ... | ... | @@ -219,7 +219,7 @@ void bigint_init_bigfloat(BigInt *dest, const BigFloat *op) { |
| 219 | 219 | ui64_to_f128M(UINT64_MAX, &max_u64); |
| 220 | 220 | if (f128M_le(&abs_val, &max_u64)) { |
| 221 | 221 | dest->digit_count = 1; |
| 222 | dest->data.digit = f128M_to_ui64(&op->value, softfloat_round_minMag, false); | |
| 222 | dest->data.digit = f128M_to_ui64(&abs_val, softfloat_round_minMag, false); | |
| 223 | 223 | bigint_normalize(dest); |
| 224 | 224 | return; |
| 225 | 225 | } |
test/behavior/floatop.zig+6| ... | ... | @@ -66,3 +66,9 @@ fn testDifferentSizedFloatComparisons() !void { |
| 66 | 66 | // try expect(@nearbyint(a) == -4); |
| 67 | 67 | // } |
| 68 | 68 | //} |
| 69 | ||
| 70 | test "negative f128 floatToInt at compile-time" { | |
| 71 | const a: f128 = -2; | |
| 72 | var b = @floatToInt(i64, a); | |
| 73 | try expect(@as(i64, -2) == b); | |
| 74 | } |