msvcrt: Convert double (numerically) to UINT64 via INT64, fixing pow() on arm.
commit37b896db48fb049f8d0c7afe2a4ab98786787658
authorMartin Storsjo <martin@martin.st>
Mon, 26 Jul 2021 22:28:01 +0000 (27 01:28 +0300)
committerAlexandre Julliard <julliard@winehq.org>
Wed, 28 Jul 2021 20:07:05 +0000 (28 22:07 +0200)
treea1cba696794d121aabc2fccebc90570d6f722edc
parent057ecd41cc98cc8c18b04058c0f4323495904e07
msvcrt: Convert double (numerically) to UINT64 via INT64, fixing pow() on arm.

If converting a negative double to an UINT64, on arm it's clipped
to zero instead of converted to its two's complement form (contrary
to x86).

This fixes cases like pow(2.0, -2.0) on arm/aarch64. Add similar
casts to expf() too which seems to have a similar pattern, even if
it's not known if that case can cause issues or not.

In the original musl source, the converttoint() function returns a
signed int32_t, doing the same double->signed->unsigned conversion,
implicitly.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
dlls/msvcrt/math.c