| author | |
| committer | |
| log | a64989ee704255f61639c9714c5a38b4d6eb0a9e |
| tree | 841aecfa75d79bcc584a4e123ed451462a3829ab |
| parent | ec58ddf46c4e1ac060333c6d0780955acae22442 |
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 | } |