Commit f0c70050 authored by Alexandre Julliard's avatar Alexandre Julliard

msvcrt: Use the log()/logf() implementation from the bundled musl library.

parent 3fad9cac
......@@ -63,11 +63,13 @@ double __cdecl log(double x)
if (predict_false(top - 0x0010 >= 0x7ff0 - 0x0010)) {
/* x < 0x1p-1022 or inf or nan. */
if (ix * 2 == 0)
return __math_divzero(1);
return math_error(_SING, "log", x, 0, (top & 0x8000 ? 1.0 : -1.0) / x);
if (ix == asuint64(INFINITY)) /* log(inf) == inf. */
return x;
if ((top & 0x8000) || (top & 0x7ff0) == 0x7ff0)
return __math_invalid(x);
if ((top & 0x7ff0) == 0x7ff0 && (ix & 0xfffffffffffffULL))
return x;
if (top & 0x8000)
return math_error(_DOMAIN, "log", x, 0, (x - x) / (x - x));
/* x is subnormal, normalize it. */
ix = asuint64(x * 0x1p52);
ix -= 52ULL << 52;
......
......@@ -37,11 +37,13 @@ float __cdecl logf(float x)
if (predict_false(ix - 0x00800000 >= 0x7f800000 - 0x00800000)) {
/* x < 0x1p-126 or inf or nan. */
if (ix * 2 == 0)
return __math_divzerof(1);
return math_error(_SING, "logf", x, 0, (ix & 0x80000000 ? 1.0 : -1.0) / x);
if (ix == 0x7f800000) /* log(inf) == inf. */
return x;
if ((ix & 0x80000000) || ix * 2 >= 0xff000000)
return __math_invalidf(x);
if (ix * 2 > 0xff000000)
return x;
if (ix & 0x80000000)
return math_error(_DOMAIN, "logf", x, 0, (x - x) / (x - x));
/* x is subnormal, normalize it. */
ix = asuint(x * 0x1p23f);
ix -= 23 << 23;
......
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