Skip to content
Commit a6e3027d authored by icedrocket's avatar icedrocket Committed by Craig Topper
Browse files

[X86] Avoid converting u64 to f32 using x87 on Windows

The code below currently prints less accurate values only on Windows 32-bit. On Windows, the default precision control on x87 is only 53-bit, and FADD triggers rounding with that precision, so the final result may be less accurate. This revision avoids less accurate conversions by using library calls instead.

```

int main() {
    int64_t n = 0b0000000000111111111111111111111111011111111111111111111111111111;
    printf("%lld, %.0f, %.0f", n, (float)n, (float)(uint64_t)n);

    return 0;
}
```

Reviewed By: craig.topper, lebedev.ri

Differential Revision: https://reviews.llvm.org/D141074
parent 83d56fb1
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment