Commit b6774e38 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

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

Signed-off-by: 's avatarAlex Henrie <alexhenrie24@gmail.com> Signed-off-by: piotr@codeweavers.com Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 96ba1bc4
......@@ -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 */
......
......@@ -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},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment