msvcrt: Don't report an underflow for ldexp(0, x) or _scalb(0, x).

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: piotr@codeweavers.com
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alex Henrie 2018-09-10 22:42:03 -06:00 committed by Alexandre Julliard
parent 96ba1bc478
commit b6774e38e6
2 changed files with 3 additions and 1 deletions

View File

@ -1015,7 +1015,7 @@ double CDECL MSVCRT_ldexp(double num, MSVCRT_long exp)
if (isfinite(num) && !isfinite(z))
math_error(_OVERFLOW, "ldexp", num, exp, z);
else if (isfinite(num) && !z)
else if (num && isfinite(num) && !z)
math_error(_UNDERFLOW, "ldexp", num, exp, z);
else if (z == 0 && signbit(z))
z = 0.0; /* Convert -0 -> +0 */

View File

@ -694,11 +694,13 @@ static void test_math_errors(void)
} testsdl[] = {
{"_scalb", -INFINITY, 1, -1, -1},
{"_scalb", -1e100, 1, -1, -1},
{"_scalb", 0, 1, -1, -1},
{"_scalb", 1e100, 1, -1, -1},
{"_scalb", INFINITY, 1, -1, -1},
{"_scalb", 1, 1e9, ERANGE, _OVERFLOW},
{"ldexp", -INFINITY, 1, -1, -1},
{"ldexp", -1e100, 1, -1, -1},
{"ldexp", 0, 1, -1, -1},
{"ldexp", 1e100, 1, -1, -1},
{"ldexp", INFINITY, 1, -1, -1},
{"ldexp", 1, -1e9, -1, _UNDERFLOW},