winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
April 2023
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
817 discussions
Start a n
N
ew thread
Alexandre Julliard : msvcrt: Use the j0()/y0() implementation from the bundled musl library.
by Alexandre Julliard
05 Apr '23
05 Apr '23
Module: wine Branch: master Commit: c75a04104444b5f27dec92259bcafd50f554b508 URL:
https://gitlab.winehq.org/wine/wine/-/commit/c75a04104444b5f27dec92259bcafd…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Apr 4 15:03:13 2023 +0200 msvcrt: Use the j0()/y0() implementation from the bundled musl library. --- dlls/msvcrt/math.c | 290 ------------------------------------------------ libs/musl/src/math/j0.c | 8 +- 2 files changed, 5 insertions(+), 293 deletions(-)
1
0
0
0
Alexandre Julliard : msvcrt: Use the expm1()/expm1f() implementation from the bundled musl library.
by Alexandre Julliard
05 Apr '23
05 Apr '23
Module: wine Branch: master Commit: 4ef90e94fd0c90360fce50899a3b68ed289e864b URL:
https://gitlab.winehq.org/wine/wine/-/commit/4ef90e94fd0c90360fce50899a3b68…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Apr 3 17:37:52 2023 +0200 msvcrt: Use the expm1()/expm1f() implementation from the bundled musl library. --- dlls/msvcrt/math.c | 217 ++------------------------------------------ libs/musl/src/math/expm1.c | 7 +- libs/musl/src/math/expm1f.c | 7 +- 3 files changed, 17 insertions(+), 214 deletions(-) diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 0c0e9df41c7..be24a75a14f 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -489,93 +489,6 @@ static double __round(double x) } #if !defined(__i386__) || _MSVCR_VER >= 120 -/* Copied from musl: src/math/expm1f.c */ -static float __expm1f(float x) -{ - static const float ln2_hi = 6.9313812256e-01, - ln2_lo = 9.0580006145e-06, - invln2 = 1.4426950216e+00, - Q1 = -3.3333212137e-2, - Q2 = 1.5807170421e-3; - - float y, hi, lo, c, t, e, hxs, hfx, r1, twopk; - union {float f; UINT32 i;} u = {x}; - UINT32 hx = u.i & 0x7fffffff; - int k, sign = u.i >> 31; - - /* filter out huge and non-finite argument */ - if (hx >= 0x4195b844) { /* if |x|>=27*ln2 */ - if (hx >= 0x7f800000) /* NaN */ - return u.i == 0xff800000 ? -1 : x; - if (sign) - return math_error(_UNDERFLOW, "exp", x, 0, -1); - if (hx > 0x42b17217) /* x > log(FLT_MAX) */ - return math_error(_OVERFLOW, "exp", x, 0, fp_barrierf(x * FLT_MAX)); - } - - /* argument reduction */ - if (hx > 0x3eb17218) { /* if |x| > 0.5 ln2 */ - if (hx < 0x3F851592) { /* and |x| < 1.5 ln2 */ - if (!sign) { - hi = x - ln2_hi; - lo = ln2_lo; - k = 1; - } else { - hi = x + ln2_hi; - lo = -ln2_lo; - k = -1; - } - } else { - k = invln2 * x + (sign ? -0.5f : 0.5f); - t = k; - hi = x - t * ln2_hi; /* t*ln2_hi is exact here */ - lo = t * ln2_lo; - } - x = hi - lo; - c = (hi - x) - lo; - } else if (hx < 0x33000000) { /* when |x|<2**-25, return x */ - if (hx < 0x00800000) - fp_barrierf(x * x); - return x; - } else - k = 0; - - /* x is now in primary range */ - hfx = 0.5f * x; - hxs = x * hfx; - r1 = 1.0f + hxs * (Q1 + hxs * Q2); - t = 3.0f - r1 * hfx; - e = hxs * ((r1 - t) / (6.0f - x * t)); - if (k == 0) /* c is 0 */ - return x - (x * e - hxs); - e = x * (e - c) - c; - e -= hxs; - /* exp(x) ~ 2^k (x_reduced - e + 1) */ - if (k == -1) - return 0.5f * (x - e) - 0.5f; - if (k == 1) { - if (x < -0.25f) - return -2.0f * (e - (x + 0.5f)); - return 1.0f + 2.0f * (x - e); - } - u.i = (0x7f + k) << 23; /* 2^k */ - twopk = u.f; - if (k < 0 || k > 56) { /* suffice to return exp(x)-1 */ - y = x - e + 1.0f; - if (k == 128) - y = y * 2.0f * 0x1p127f; - else - y = y * twopk; - return y - 1.0f; - } - u.i = (0x7f-k) << 23; /* 2^-k */ - if (k < 23) - y = (x - e + (1 - u.f)) * twopk; - else - y = (x - (e + u.f) + 1) * twopk; - return y; -} - #ifndef __i386__ /* Copied from musl: src/math/__sindf.c */ static float __sindf(double x) @@ -1102,7 +1015,7 @@ float CDECL coshf( float x ) fp_barrierf(x + 0x1p120f); return 1; } - t = __expm1f(x); + t = expm1f(x); return 1 + t * t / (2 * (1 + t)); } @@ -1641,7 +1554,7 @@ float CDECL sinhf( float x ) /* |x| < log(FLT_MAX) */ if (ui < 0x42b17217) { - t = __expm1f(absx); + t = expm1f(absx); if (ui < 0x3f800000) { if (ui < 0x3f800000 - (12 << 23)) return x; @@ -1855,16 +1768,16 @@ float CDECL tanhf( float x ) fp_barrierf(x + 0x1p120f); t = 1 + 0 / x; } else { - t = __expm1f(2 * x); + t = expm1f(2 * x); t = 1 - 2 / (t + 2); } } else if (ui > 0x3e82c578) { /* |x| > log(5/3)/2 ~= 0.2554 */ - t = __expm1f(2 * x); + t = expm1f(2 * x); t = t / (t + 2); } else if (ui >= 0x00800000) { /* |x| >= 0x1p-126 */ - t = __expm1f(-2 * x); + t = expm1f(-2 * x); t = -t / (t + 2); } else { /* |x| is subnormal */ @@ -2536,100 +2449,6 @@ double CDECL cos( double x ) } } -/* Copied from musl: src/math/expm1.c */ -static double __expm1(double x) -{ - static const double o_threshold = 7.09782712893383973096e+02, - ln2_hi = 6.93147180369123816490e-01, - ln2_lo = 1.90821492927058770002e-10, - invln2 = 1.44269504088896338700e+00, - Q1 = -3.33333333333331316428e-02, - Q2 = 1.58730158725481460165e-03, - Q3 = -7.93650757867487942473e-05, - Q4 = 4.00821782732936239552e-06, - Q5 = -2.01099218183624371326e-07; - - double y, hi, lo, c, t, e, hxs, hfx, r1, twopk; - union {double f; UINT64 i;} u = {x}; - UINT32 hx = u.i >> 32 & 0x7fffffff; - int k, sign = u.i >> 63; - - /* filter out huge and non-finite argument */ - if (hx >= 0x4043687A) { /* if |x|>=56*ln2 */ - if (isnan(x)) - return x; - if (isinf(x)) - return sign ? -1 : x; - if (sign) - return math_error(_UNDERFLOW, "exp", x, 0, -1); - if (x > o_threshold) - return math_error(_OVERFLOW, "exp", x, 0, x * 0x1p1023); - } - - /* argument reduction */ - if (hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */ - if (hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */ - if (!sign) { - hi = x - ln2_hi; - lo = ln2_lo; - k = 1; - } else { - hi = x + ln2_hi; - lo = -ln2_lo; - k = -1; - } - } else { - k = invln2 * x + (sign ? -0.5 : 0.5); - t = k; - hi = x - t * ln2_hi; /* t*ln2_hi is exact here */ - lo = t * ln2_lo; - } - x = hi - lo; - c = (hi - x) - lo; - } else if (hx < 0x3c900000) { /* |x| < 2**-54, return x */ - fp_barrier(x + 0x1p120f); - if (hx < 0x00100000) - fp_barrier((float)x); - return x; - } else - k = 0; - - /* x is now in primary range */ - hfx = 0.5 * x; - hxs = x * hfx; - r1 = 1.0 + hxs * (Q1 + hxs * (Q2 + hxs * (Q3 + hxs * (Q4 + hxs * Q5)))); - t = 3.0 - r1 * hfx; - e = hxs * ((r1 - t) / (6.0 - x * t)); - if (k == 0) /* c is 0 */ - return x - (x * e - hxs); - e = x * (e - c) - c; - e -= hxs; - /* exp(x) ~ 2^k (x_reduced - e + 1) */ - if (k == -1) - return 0.5 * (x - e) - 0.5; - if (k == 1) { - if (x < -0.25) - return -2.0 * (e - (x + 0.5)); - return 1.0 + 2.0 * (x - e); - } - u.i = (UINT64)(0x3ff + k) << 52; /* 2^k */ - twopk = u.f; - if (k < 0 || k > 56) { /* suffice to return exp(x)-1 */ - y = x - e + 1.0; - if (k == 1024) - y = y * 2.0 * 0x1p1023; - else - y = y * twopk; - return y - 1.0; - } - u.i = (UINT64)(0x3ff - k) << 52; /* 2^-k */ - if (k < 20) - y = (x - e + (1 - u.f)) * twopk; - else - y = (x - (e + u.f) + 1) * twopk; - return y; -} - static double __expo2(double x, double sign) { static const int k = 2043; @@ -2663,7 +2482,7 @@ double CDECL cosh( double x ) fp_barrier(x + 0x1p120f); return 1; } - t = __expm1(x); + t = expm1(x); return 1 + t * t / (2 * (1 + t)); } @@ -3932,7 +3751,7 @@ double CDECL sinh( double x ) /* |x| < log(DBL_MAX) */ if (w < 0x40862e42) { - t = __expm1(absx); + t = expm1(absx); if (w < 0x3ff00000) { if (w < 0x3ff00000 - (26 << 20)) return x; @@ -4233,16 +4052,16 @@ double CDECL tanh( double x ) fp_barrier(x + 0x1p120f); t = 1 - 0 / x; } else { - t = __expm1(2 * x); + t = expm1(2 * x); t = 1 - 2 / (t + 2); } } else if (w > 0x3fd058ae) { /* |x| > log(5/3)/2 ~= 0.2554 */ - t = __expm1(2 * x); + t = expm1(2 * x); t = t / (t + 2); } else if (w >= 0x00100000) { /* |x| >= 0x1p-1022, up to 2ulp error in [0.1,0.2554] */ - t = __expm1(-2 * x); + t = expm1(-2 * x); t = -t / (t + 2); } else { /* |x| is subnormal */ @@ -7666,22 +7485,6 @@ float CDECL exp2f(float x) return y; } -/********************************************************************* - * expm1 (MSVCR120.@) - */ -double CDECL expm1(double x) -{ - return __expm1(x); -} - -/********************************************************************* - * expm1f (MSVCR120.@) - */ -float CDECL expm1f(float x) -{ - return __expm1f(x); -} - /********************************************************************* * log1p (MSVCR120.@) * diff --git a/libs/musl/src/math/expm1.c b/libs/musl/src/math/expm1.c index 01c303c3e7d..d29f73fac69 100644 --- a/libs/musl/src/math/expm1.c +++ b/libs/musl/src/math/expm1.c @@ -129,11 +129,12 @@ double __cdecl expm1(double x) if (hx >= 0x4043687A) { /* if |x|>=56*ln2 */ if (isnan(x)) return x; + if (isinf(x)) + return sign ? -1 : x; if (sign) - return -1; + return math_error(_UNDERFLOW, "exp", x, 0, -1); if (x > o_threshold) { - x *= 0x1p1023; - return x; + return math_error(_OVERFLOW, "exp", x, 0, x * 0x1p1023); } } diff --git a/libs/musl/src/math/expm1f.c b/libs/musl/src/math/expm1f.c index 4fb10625c0c..3cd81903cc9 100644 --- a/libs/musl/src/math/expm1f.c +++ b/libs/musl/src/math/expm1f.c @@ -37,12 +37,11 @@ float __cdecl expm1f(float x) /* filter out huge and non-finite argument */ if (hx >= 0x4195b844) { /* if |x|>=27*ln2 */ if (hx > 0x7f800000) /* NaN */ - return x; + return u.i == 0xff800000 ? -1 : x; if (sign) - return -1; + return math_error(_UNDERFLOW, "exp", x, 0, -1); if (hx > 0x42b17217) { /* x > log(FLT_MAX) */ - x *= 0x1p127f; - return x; + return math_error(_OVERFLOW, "exp", x, 0, fp_barrierf(x * FLT_MAX)); } }
1
0
0
0
Alexandre Julliard : msvcrt: Use the tgamma()/tgammaf() implementation from the bundled musl library.
by Alexandre Julliard
05 Apr '23
05 Apr '23
Module: wine Branch: master Commit: dae30bd66d34fd1e4db976dda8946843a2a89417 URL:
https://gitlab.winehq.org/wine/wine/-/commit/dae30bd66d34fd1e4db976dda89468…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Apr 3 17:33:33 2023 +0200 msvcrt: Use the tgamma()/tgammaf() implementation from the bundled musl library. --- dlls/msvcrt/math.c | 155 -------------------------------------------- libs/musl/src/math/tgamma.c | 13 +++- 2 files changed, 10 insertions(+), 158 deletions(-) diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 20ce8bf9599..0c0e9df41c7 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -8996,161 +8996,6 @@ float CDECL remainderf(float x, float y) return remquof(x, y, &q); } -/* sin(pi*x) assuming x > 2^-100, if sin(pi*x)==0 the sign is arbitrary */ -static double sin_pi(double x) -{ - int n; - - /* spurious inexact if odd int */ - x = 2.0 * (x * 0.5 - floor(x * 0.5)); /* x mod 2.0 */ - - n = x * 4.0; - n = (n + 1) / 2; - x -= n * 0.5f; - x *= M_PI; - - switch (n) { - default: /* case 4: */ - case 0: return __sin(x, 0.0, 0); - case 1: return __cos(x, 0.0); - case 2: return __sin(-x, 0.0, 0); - case 3: return -__cos(x, 0.0); - } -} - -static double tgamma_S(double x) -{ - static const double Snum[] = { - 23531376880.410759688572007674451636754734846804940, - 42919803642.649098768957899047001988850926355848959, - 35711959237.355668049440185451547166705960488635843, - 17921034426.037209699919755754458931112671403265390, - 6039542586.3520280050642916443072979210699388420708, - 1439720407.3117216736632230727949123939715485786772, - 248874557.86205415651146038641322942321632125127801, - 31426415.585400194380614231628318205362874684987640, - 2876370.6289353724412254090516208496135991145378768, - 186056.26539522349504029498971604569928220784236328, - 8071.6720023658162106380029022722506138218516325024, - 210.82427775157934587250973392071336271166969580291, - 2.5066282746310002701649081771338373386264310793408, - }; - static const double Sden[] = { - 0, 39916800, 120543840, 150917976, 105258076, 45995730, 13339535, - 2637558, 357423, 32670, 1925, 66, 1, - }; - - double num = 0, den = 0; - int i; - - /* to avoid overflow handle large x differently */ - if (x < 8) - for (i = ARRAY_SIZE(Snum) - 1; i >= 0; i--) { - num = num * x + Snum[i]; - den = den * x + Sden[i]; - } - else - for (i = 0; i < ARRAY_SIZE(Snum); i++) { - num = num / x + Snum[i]; - den = den / x + Sden[i]; - } - return num / den; -} - -/********************************************************************* - * tgamma (MSVCR120.@) - * - * Copied from musl: src/math/tgamma.c - */ -double CDECL tgamma(double x) -{ - static const double gmhalf = 5.524680040776729583740234375; - static const double fact[] = { - 1, 1, 2, 6, 24, 120, 720, 5040.0, 40320.0, 362880.0, 3628800.0, 39916800.0, - 479001600.0, 6227020800.0, 87178291200.0, 1307674368000.0, 20922789888000.0, - 355687428096000.0, 6402373705728000.0, 121645100408832000.0, - 2432902008176640000.0, 51090942171709440000.0, 1124000727777607680000.0, - }; - - union {double f; UINT64 i;} u = {x}; - double absx, y, dy, z, r; - UINT32 ix = u.i >> 32 & 0x7fffffff; - int sign = u.i >> 63; - - /* special cases */ - if (ix >= 0x7ff00000) { - /* tgamma(nan)=nan, tgamma(inf)=inf, tgamma(-inf)=nan with invalid */ - if (u.i == 0xfff0000000000000ULL) - *_errno() = EDOM; - return x + INFINITY; - } - if (ix < (0x3ff - 54) << 20) { - /* |x| < 2^-54: tgamma(x) ~ 1/x, +-0 raises div-by-zero */ - if (x == 0.0) - *_errno() = ERANGE; - return 1 / x; - } - - /* integer arguments */ - /* raise inexact when non-integer */ - if (x == floor(x)) { - if (sign) { - *_errno() = EDOM; - return 0 / (x - x); - } - if (x <= ARRAY_SIZE(fact)) - return fact[(int)x - 1]; - } - - /* x >= 172: tgamma(x)=inf with overflow */ - /* x =< -184: tgamma(x)=+-0 with underflow */ - if (ix >= 0x40670000) { /* |x| >= 184 */ - *_errno() = ERANGE; - if (sign) { - fp_barrierf(0x1p-126 / x); - return 0; - } - x *= 0x1p1023; - return x; - } - - absx = sign ? -x : x; - - /* handle the error of x + g - 0.5 */ - y = absx + gmhalf; - if (absx > gmhalf) { - dy = y - absx; - dy -= gmhalf; - } else { - dy = y - gmhalf; - dy -= absx; - } - - z = absx - 0.5; - r = tgamma_S(absx) * exp(-y); - if (x < 0) { - /* reflection formula for negative x */ - /* sinpi(absx) is not 0, integers are already handled */ - r = -M_PI / (sin_pi(absx) * absx * r); - dy = -dy; - z = -z; - } - r += dy * (gmhalf + 0.5) * r / y; - z = pow(y, 0.5 * z); - y = r * z * z; - return y; -} - -/********************************************************************* - * tgammaf (MSVCR120.@) - * - * Copied from musl: src/math/tgammaf.c - */ -float CDECL tgammaf(float x) -{ - return tgamma(x); -} - /********************************************************************* * _except1 (MSVCR120.@) * TODO: diff --git a/libs/musl/src/math/tgamma.c b/libs/musl/src/math/tgamma.c index 94c8d14f000..8bea688565b 100644 --- a/libs/musl/src/math/tgamma.c +++ b/libs/musl/src/math/tgamma.c @@ -114,18 +114,24 @@ double __cdecl tgamma(double x) int sign = u.i>>63; /* special cases */ - if (ix >= 0x7ff00000) + if (ix >= 0x7ff00000) { /* tgamma(nan)=nan, tgamma(inf)=inf, tgamma(-inf)=nan with invalid */ + if (u.i == 0xfff0000000000000ULL) errno = EDOM; return x + INFINITY; - if (ix < (0x3ff-54)<<20) + } + if (ix < (0x3ff-54)<<20) { /* |x| < 2^-54: tgamma(x) ~ 1/x, +-0 raises div-by-zero */ + if (x == 0.0) errno = ERANGE; return 1/x; + } /* integer arguments */ /* raise inexact when non-integer */ if (x == floor(x)) { - if (sign) + if (sign) { + errno = EDOM; return 0/0.0; + } if (x <= sizeof fact/sizeof *fact) return fact[(int)x - 1]; } @@ -133,6 +139,7 @@ double __cdecl tgamma(double x) /* x >= 172: tgamma(x)=inf with overflow */ /* x =< -184: tgamma(x)=+-0 with underflow */ if (ix >= 0x40670000) { /* |x| >= 184 */ + errno = ERANGE; if (sign) { FORCE_EVAL((float)(0x1p-126/x)); if (floor(x) * 0.5 == floor(x * 0.5))
1
0
0
0
Alexandre Julliard : msvcrt: Use the lgamma()/lgammaf() implementation from the bundled musl library.
by Alexandre Julliard
05 Apr '23
05 Apr '23
Module: wine Branch: master Commit: 442052fe1872f6a1461abb7231025340beb177d0 URL:
https://gitlab.winehq.org/wine/wine/-/commit/442052fe1872f6a1461abb72310253…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Apr 3 17:20:19 2023 +0200 msvcrt: Use the lgamma()/lgammaf() implementation from the bundled musl library. --- dlls/msvcrt/math.c | 382 +---------------------------------------- libs/musl/src/math/lgamma_r.c | 4 +- libs/musl/src/math/lgammaf_r.c | 4 +- 3 files changed, 8 insertions(+), 382 deletions(-)
1
0
0
0
Alexandre Julliard : msvcrt: Use the remquo()/remquof() implementation from the bundled musl library.
by Alexandre Julliard
05 Apr '23
05 Apr '23
Module: wine Branch: master Commit: f27f2d4e6643ca5a64e5cb2a0a9e04721fb0c8e6 URL:
https://gitlab.winehq.org/wine/wine/-/commit/f27f2d4e6643ca5a64e5cb2a0a9e04…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Apr 3 17:17:12 2023 +0200 msvcrt: Use the remquo()/remquof() implementation from the bundled musl library. --- dlls/msvcrt/math.c | 169 ------------------------------------------- libs/musl/src/math/remquo.c | 2 + libs/musl/src/math/remquof.c | 2 + 3 files changed, 4 insertions(+), 169 deletions(-) diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 94da43ec3f6..0c84dc23c8d 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -8994,175 +8994,6 @@ float CDECL remainderf(float x, float y) return remquof(x, y, &q); } -/********************************************************************* - * remquo (MSVCR120.@) - * - * Copied from musl: src/math/remquo.c - */ -double CDECL remquo(double x, double y, int *quo) -{ - UINT64 uxi = *(UINT64*)&x; - UINT64 uyi = *(UINT64*)&y; - int ex = uxi >> 52 & 0x7ff; - int ey = uyi >> 52 & 0x7ff; - int sx = uxi >> 63; - int sy = uyi >> 63; - UINT32 q; - UINT64 i; - - *quo = 0; - if (y == 0 || isinf(x)) *_errno() = EDOM; - if (uyi << 1 == 0 || isnan(y) || ex == 0x7ff) - return (x * y) / (x * y); - if (uxi << 1 == 0) - return x; - - /* normalize x and y */ - if (!ex) { - for (i = uxi << 12; i >> 63 == 0; ex--, i <<= 1); - uxi <<= -ex + 1; - } else { - uxi &= -1ULL >> 12; - uxi |= 1ULL << 52; - } - if (!ey) { - for (i = uyi << 12; i >> 63 == 0; ey--, i <<= 1); - uyi <<= -ey + 1; - } else { - uyi &= -1ULL >> 12; - uyi |= 1ULL << 52; - } - - q = 0; - if (ex < ey) { - if (ex+1 == ey) - goto end; - return x; - } - - /* x mod y */ - for (; ex > ey; ex--) { - i = uxi - uyi; - if (i >> 63 == 0) { - uxi = i; - q++; - } - uxi <<= 1; - q <<= 1; - } - i = uxi - uyi; - if (i >> 63 == 0) { - uxi = i; - q++; - } - if (uxi == 0) - ex = -60; - else - for (; uxi >> 52 == 0; uxi <<= 1, ex--); -end: - /* scale result and decide between |x| and |x|-|y| */ - if (ex > 0) { - uxi -= 1ULL << 52; - uxi |= (UINT64)ex << 52; - } else { - uxi >>= -ex + 1; - } - x = *(double*)&uxi; - if (sy) - y = -y; - if (ex == ey || (ex + 1 == ey && (2 * x > y || (2 * x == y && q % 2)))) { - x -= y; - q++; - } - q &= 0x7fffffff; - *quo = sx ^ sy ? -(int)q : (int)q; - return sx ? -x : x; -} - -/********************************************************************* - * remquof (MSVCR120.@) - * - * Copied from musl: src/math/remquof.c - */ -float CDECL remquof(float x, float y, int *quo) -{ - UINT32 uxi = *(UINT32*)&x; - UINT32 uyi = *(UINT32*)&y; - int ex = uxi >> 23 & 0xff; - int ey = uyi >> 23 & 0xff; - int sx = uxi >> 31; - int sy = uyi>> 31; - UINT32 q, i; - - *quo = 0; - if (y == 0 || isinf(x)) *_errno() = EDOM; - if (uyi << 1 == 0 || isnan(y) || ex == 0xff) - return (x * y) / (x * y); - if (uxi << 1 == 0) - return x; - - /* normalize x and y */ - if (!ex) { - for (i = uxi << 9; i >> 31 == 0; ex--, i <<= 1); - uxi <<= -ex + 1; - } else { - uxi &= -1U >> 9; - uxi |= 1U << 23; - } - if (!ey) { - for (i = uyi << 9; i >> 31 == 0; ey--, i <<= 1); - uyi <<= -ey + 1; - } else { - uyi &= -1U >> 9; - uyi |= 1U << 23; - } - - q = 0; - if (ex < ey) { - if (ex + 1 == ey) - goto end; - return x; - } - - /* x mod y */ - for (; ex > ey; ex--) { - i = uxi - uyi; - if (i >> 31 == 0) { - uxi = i; - q++; - } - uxi <<= 1; - q <<= 1; - } - i = uxi - uyi; - if (i >> 31 == 0) { - uxi = i; - q++; - } - if (uxi == 0) - ex = -30; - else - for (; uxi >> 23 == 0; uxi <<= 1, ex--); -end: - /* scale result and decide between |x| and |x|-|y| */ - if (ex > 0) { - uxi -= 1U << 23; - uxi |= (UINT32)ex << 23; - } else { - uxi >>= -ex + 1; - } - x = *(float*)&uxi; - if (sy) - y = -y; - if (ex == ey || (ex + 1 == ey && (2 * x > y || (2 * x == y && q % 2)))) { - x -= y; - q++; - } - q &= 0x7fffffff; - *quo = sx ^ sy ? -(int)q : (int)q; - return sx ? -x : x; -} - /* sin(pi*x) assuming x > 2^-100, if sin(pi*x)==0 the sign is arbitrary */ static double sin_pi(double x) { diff --git a/libs/musl/src/math/remquo.c b/libs/musl/src/math/remquo.c index 6ba88688623..04bdce5027f 100644 --- a/libs/musl/src/math/remquo.c +++ b/libs/musl/src/math/remquo.c @@ -1,5 +1,6 @@ #include <math.h> #include <stdint.h> +#include "libm.h" double __cdecl remquo(double x, double y, int *quo) { @@ -13,6 +14,7 @@ double __cdecl remquo(double x, double y, int *quo) uint64_t uxi = ux.i; *quo = 0; + if (y == 0 || isinf(x)) errno = EDOM; if (uy.i<<1 == 0 || isnan(y) || ex == 0x7ff) return (x*y)/(x*y); if (ux.i<<1 == 0) diff --git a/libs/musl/src/math/remquof.c b/libs/musl/src/math/remquof.c index cd3bde759a8..26d48091db0 100644 --- a/libs/musl/src/math/remquof.c +++ b/libs/musl/src/math/remquof.c @@ -1,5 +1,6 @@ #include <math.h> #include <stdint.h> +#include "libm.h" float __cdecl remquof(float x, float y, int *quo) { @@ -13,6 +14,7 @@ float __cdecl remquof(float x, float y, int *quo) uint32_t uxi = ux.i; *quo = 0; + if (y == 0 || isinf(x)) errno = EDOM; if (uy.i<<1 == 0 || isnan(y) || ex == 0xff) return (x*y)/(x*y); if (ux.i<<1 == 0)
1
0
0
0
Alexandre Julliard : msvcrt: Use the logb()/logbf() implementation from the bundled musl library.
by Alexandre Julliard
05 Apr '23
05 Apr '23
Module: wine Branch: master Commit: 1cff65b69fb05e960a998d8b43acbdd8dbb2d7a9 URL:
https://gitlab.winehq.org/wine/wine/-/commit/1cff65b69fb05e960a998d8b43acbd…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Apr 3 17:14:30 2023 +0200 msvcrt: Use the logb()/logbf() implementation from the bundled musl library. --- dlls/crtdll/crtdll.spec | 2 +- dlls/msvcr100/msvcr100.spec | 4 ++-- dlls/msvcr110/msvcr110.spec | 4 ++-- dlls/msvcr120/msvcr120.spec | 10 +++++----- dlls/msvcr70/msvcr70.spec | 2 +- dlls/msvcr71/msvcr71.spec | 2 +- dlls/msvcr80/msvcr80.spec | 4 ++-- dlls/msvcr90/msvcr90.spec | 4 ++-- dlls/msvcrt/math.c | 32 +------------------------------- dlls/msvcrt/msvcrt.spec | 4 ++-- dlls/msvcrtd/msvcrtd.spec | 2 +- dlls/ucrtbase/ucrtbase.spec | 20 ++++++++++---------- libs/musl/src/internal/libm.h | 2 ++ libs/musl/src/math/logb.c | 2 +- libs/musl/src/math/logbf.c | 5 ++++- 15 files changed, 37 insertions(+), 62 deletions(-) diff --git a/dlls/crtdll/crtdll.spec b/dlls/crtdll/crtdll.spec index c66cea5bade..3a90ad7ef74 100644 --- a/dlls/crtdll/crtdll.spec +++ b/dlls/crtdll/crtdll.spec @@ -179,7 +179,7 @@ @ cdecl _loaddll(str) @ cdecl -arch=i386 _local_unwind2(ptr long) @ cdecl _locking(long long long) -@ cdecl _logb(double) +@ cdecl _logb(double) logb @ cdecl _lrotl(long long) MSVCRT__lrotl @ cdecl _lrotr(long long) MSVCRT__lrotr @ cdecl _lsearch(ptr ptr ptr long ptr) diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index a42fe349cf5..1b9abbfdec2 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -1052,8 +1052,8 @@ @ cdecl _lock(long) @ cdecl _lock_file(ptr) @ cdecl _locking(long long long) -@ cdecl _logb(double) -@ cdecl -arch=!i386 _logbf(float) +@ cdecl _logb(double) logb +@ cdecl -arch=!i386 _logbf(float) logbf @ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp @ cdecl _lrotl(long long) MSVCRT__lrotl @ cdecl _lrotr(long long) MSVCRT__lrotr diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index 2bccd8c6fe9..bba1222a44e 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -1409,8 +1409,8 @@ @ cdecl _lock(long) @ cdecl _lock_file(ptr) @ cdecl _locking(long long long) -@ cdecl _logb(double) -@ cdecl -arch=!i386 _logbf(float) +@ cdecl _logb(double) logb +@ cdecl -arch=!i386 _logbf(float) logbf @ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp @ cdecl _lrotl(long long) MSVCRT__lrotl @ cdecl _lrotr(long long) MSVCRT__lrotr diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index ed0f69b49bc..654fb4071f8 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -1420,8 +1420,8 @@ @ cdecl _lock(long) @ cdecl _lock_file(ptr) @ cdecl _locking(long long long) -@ cdecl _logb(double) -@ cdecl -arch=!i386 _logbf(float) +@ cdecl _logb(double) logb +@ cdecl -arch=!i386 _logbf(float) logbf @ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp @ cdecl _lrotl(long long) MSVCRT__lrotl @ cdecl _lrotr(long long) MSVCRT__lrotr @@ -2266,9 +2266,9 @@ @ cdecl log2(double) @ cdecl log2f(float) @ cdecl log2l(double) log2 -@ cdecl logb(double) _logb -@ cdecl logbf(float) _logbf -@ cdecl logbl(double) _logb +@ cdecl logb(double) +@ cdecl logbf(float) +@ cdecl logbl(double) logb @ cdecl -arch=i386,x86_64,arm,arm64 longjmp(ptr long) MSVCRT_longjmp @ cdecl lrint(double) @ cdecl lrintf(float) diff --git a/dlls/msvcr70/msvcr70.spec b/dlls/msvcr70/msvcr70.spec index cb3a92cf395..1e02dc95d2d 100644 --- a/dlls/msvcr70/msvcr70.spec +++ b/dlls/msvcr70/msvcr70.spec @@ -408,7 +408,7 @@ @ cdecl _localtime64(ptr) @ cdecl _lock(long) @ cdecl _locking(long long long) -@ cdecl _logb(double) +@ cdecl _logb(double) logb @ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp @ cdecl _lrotl(long long) MSVCRT__lrotl @ cdecl _lrotr(long long) MSVCRT__lrotr diff --git a/dlls/msvcr71/msvcr71.spec b/dlls/msvcr71/msvcr71.spec index a559b5cc376..1a075986ddd 100644 --- a/dlls/msvcr71/msvcr71.spec +++ b/dlls/msvcr71/msvcr71.spec @@ -403,7 +403,7 @@ @ cdecl _localtime64(ptr) @ cdecl _lock(long) @ cdecl _locking(long long long) -@ cdecl _logb(double) +@ cdecl _logb(double) logb @ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp @ cdecl _lrotl(long long) MSVCRT__lrotl @ cdecl _lrotr(long long) MSVCRT__lrotr diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 06d0bdf82cd..2ea91c0ce8a 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -724,8 +724,8 @@ @ cdecl _lock(long) @ cdecl _lock_file(ptr) @ cdecl _locking(long long long) -@ cdecl _logb(double) -@ cdecl -arch=!i386 _logbf(float) +@ cdecl _logb(double) logb +@ cdecl -arch=!i386 _logbf(float) logbf @ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp @ cdecl _lrotl(long long) MSVCRT__lrotl @ cdecl _lrotr(long long) MSVCRT__lrotr diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index d020de98a02..fb274878d39 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -702,8 +702,8 @@ @ cdecl _lock(long) @ cdecl _lock_file(ptr) @ cdecl _locking(long long long) -@ cdecl _logb(double) -@ cdecl -arch=!i386 _logbf(float) +@ cdecl _logb(double) logb +@ cdecl -arch=!i386 _logbf(float) logbf @ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp @ cdecl _lrotl(long long) MSVCRT__lrotl @ cdecl _lrotr(long long) MSVCRT__lrotr diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index a000d9196df..94da43ec3f6 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -131,7 +131,7 @@ int CDECL _matherr(struct _exception *e) } -static double math_error(int type, const char *name, double arg1, double arg2, double retval) +double math_error(int type, const char *name, double arg1, double arg2, double retval) { struct _exception exception = {type, (char *)name, arg1, arg2, retval}; @@ -259,22 +259,6 @@ float CDECL _nextafterf( float x, float y ) return y; } -/********************************************************************* - * _logbf (MSVCRT.@) - * - * Copied from musl: src/math/logbf.c - */ -float CDECL _logbf(float x) -{ - if (!isfinite(x)) - return x * x; - if (x == 0) { - *_errno() = ERANGE; - return -1 / (x * x); - } - return ilogbf(x); -} - #endif /* Copied from musl: src/math/__rem_pio2_large.c */ @@ -4504,20 +4488,6 @@ __int64 CDECL _abs64( __int64 n ) return n >= 0 ? n : -n; } -/********************************************************************* - * _logb (MSVCRT.@) - * - * Copied from musl: src/math/logb.c - */ -double CDECL _logb(double x) -{ - if (!isfinite(x)) - return x * x; - if (x == 0) - return math_error(_SING, "_logb", x, 0, -1 / (x * x)); - return ilogb(x); -} - /********************************************************************* * ceil (MSVCRT.@) * diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index 43259d7abad..f339757438f 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -670,8 +670,8 @@ @ cdecl _lock(long) @ cdecl _lock_file(ptr) @ cdecl _locking(long long long) -@ cdecl _logb(double) -@ cdecl -arch=!i386 _logbf(float) +@ cdecl _logb(double) logb +@ cdecl -arch=!i386 _logbf(float) logbf @ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp @ cdecl _lrotl(long long) MSVCRT__lrotl @ cdecl _lrotr(long long) MSVCRT__lrotr diff --git a/dlls/msvcrtd/msvcrtd.spec b/dlls/msvcrtd/msvcrtd.spec index 5cb09d92c74..68fa80d532f 100644 --- a/dlls/msvcrtd/msvcrtd.spec +++ b/dlls/msvcrtd/msvcrtd.spec @@ -385,7 +385,7 @@ @ cdecl -arch=i386 _local_unwind2(ptr long) @ cdecl _lock(long) @ cdecl _locking(long long long) -@ cdecl _logb(double) +@ cdecl _logb(double) logb @ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp @ cdecl _lrotl(long long) MSVCRT__lrotl @ cdecl _lrotr(long long) MSVCRT__lrotr diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec index 87a266198bd..51137681f14 100644 --- a/dlls/ucrtbase/ucrtbase.spec +++ b/dlls/ucrtbase/ucrtbase.spec @@ -568,8 +568,8 @@ @ cdecl _lock_file(ptr) @ cdecl _lock_locales() @ cdecl _locking(long long long) -@ cdecl _logb(double) -@ cdecl -arch=!i386 _logbf(float) +@ cdecl _logb(double) logb +@ cdecl -arch=!i386 _logbf(float) logbf @ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp @ cdecl _lrotl(long long) MSVCRT__lrotl @ cdecl _lrotr(long long) MSVCRT__lrotr @@ -1142,8 +1142,8 @@ @ cdecl _o__localtime64_s(ptr ptr) _localtime64_s @ cdecl _o__lock_file(ptr) _lock_file @ cdecl _o__locking(long long long) _locking -@ cdecl _o__logb(double) _logb -@ cdecl -arch=!i386 _o__logbf(float) _logbf +@ cdecl _o__logb(double) logb +@ cdecl -arch=!i386 _o__logbf(float) logbf @ cdecl _o__lsearch(ptr ptr ptr long ptr) _lsearch @ stub _o__lsearch_s @ cdecl _o__lseek(long long long) _lseek @@ -1699,9 +1699,9 @@ @ cdecl _o_log2(double) log2 @ cdecl _o_log2f(float) log2f @ cdecl _o_log2l(double) log2 -@ cdecl _o_logb(double) _logb -@ cdecl _o_logbf(float) _logbf -@ cdecl _o_logbl(double) _logb +@ cdecl _o_logb(double) logb +@ cdecl _o_logbf(float) logbf +@ cdecl _o_logbl(double) logb @ cdecl -arch=!i386 _o_logf(float) logf @ cdecl _o_lrint(double) lrint @ cdecl _o_lrintf(float) lrintf @@ -2401,9 +2401,9 @@ @ cdecl log2(double) @ cdecl log2f(float) @ cdecl log2l(double) log2 -@ cdecl logb(double) _logb -@ cdecl logbf(float) _logbf -@ cdecl logbl(double) _logb +@ cdecl logb(double) +@ cdecl logbf(float) +@ cdecl logbl(double) logb @ cdecl -arch=!i386 logf(float) @ cdecl -arch=i386,x86_64,arm,arm64 longjmp(ptr long) MSVCRT_longjmp @ cdecl lrint(double) diff --git a/libs/musl/src/internal/libm.h b/libs/musl/src/internal/libm.h index 39233282750..a1e9bc08716 100644 --- a/libs/musl/src/internal/libm.h +++ b/libs/musl/src/internal/libm.h @@ -10,6 +10,8 @@ typedef float float_t; typedef double double_t; +hidden double math_error(int type, const char *name, double arg1, double arg2, double retval); + #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 #elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 && __BYTE_ORDER == __LITTLE_ENDIAN union ldshape { diff --git a/libs/musl/src/math/logb.c b/libs/musl/src/math/logb.c index 7c0423fb6c0..ce496e6bf18 100644 --- a/libs/musl/src/math/logb.c +++ b/libs/musl/src/math/logb.c @@ -13,6 +13,6 @@ double __cdecl logb(double x) if (!isfinite(x)) return x * x; if (x == 0) - return -1/(x*x); + return math_error(_SING, "_logb", x, 0, -1 / (x * x)); return ilogb(x); } diff --git a/libs/musl/src/math/logbf.c b/libs/musl/src/math/logbf.c index 743af679ab0..9f1728fc118 100644 --- a/libs/musl/src/math/logbf.c +++ b/libs/musl/src/math/logbf.c @@ -1,10 +1,13 @@ #include <math.h> +#include "libm.h" float __cdecl logbf(float x) { if (!isfinite(x)) return x * x; - if (x == 0) + if (x == 0) { + errno = ERANGE; return -1/(x*x); + } return ilogbf(x); }
1
0
0
0
Alexandre Julliard : msvcrt: Use the ilogb()/ilogbf() implementation from the bundled musl library.
by Alexandre Julliard
05 Apr '23
05 Apr '23
Module: wine Branch: master Commit: d1ba9a30dc7269aad8d8b6b0162917296c79db61 URL:
https://gitlab.winehq.org/wine/wine/-/commit/d1ba9a30dc7269aad8d8b6b0162917…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Apr 3 17:12:25 2023 +0200 msvcrt: Use the ilogb()/ilogbf() implementation from the bundled musl library. --- dlls/msvcrt/math.c | 55 ++------------------------------------------- libs/musl/src/math/ilogb.c | 3 --- libs/musl/src/math/ilogbf.c | 3 --- 3 files changed, 2 insertions(+), 59 deletions(-) diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 61c95512448..a000d9196df 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -259,24 +259,6 @@ float CDECL _nextafterf( float x, float y ) return y; } -/* Copied from musl: src/math/ilogbf.c */ -static int __ilogbf(float x) -{ - union { float f; UINT32 i; } u = { x }; - int e = u.i >> 23 & 0xff; - - if (!e) - { - u.i <<= 9; - if (u.i == 0) return FP_ILOGB0; - /* subnormal x */ - for (e = -0x7f; u.i >> 31 == 0; e--, u.i <<= 1); - return e; - } - if (e == 0xff) return u.i << 9 ? FP_ILOGBNAN : INT_MAX; - return e - 0x7f; -} - /********************************************************************* * _logbf (MSVCRT.@) * @@ -290,7 +272,7 @@ float CDECL _logbf(float x) *_errno() = ERANGE; return -1 / (x * x); } - return __ilogbf(x); + return ilogbf(x); } #endif @@ -4522,24 +4504,6 @@ __int64 CDECL _abs64( __int64 n ) return n >= 0 ? n : -n; } -/* Copied from musl: src/math/ilogb.c */ -static int __ilogb(double x) -{ - union { double f; UINT64 i; } u = { x }; - int e = u.i >> 52 & 0x7ff; - - if (!e) - { - u.i <<= 12; - if (u.i == 0) return FP_ILOGB0; - /* subnormal x */ - for (e = -0x3ff; u.i >> 63 == 0; e--, u.i <<= 1); - return e; - } - if (e == 0x7ff) return u.i << 12 ? FP_ILOGBNAN : INT_MAX; - return e - 0x3ff; -} - /********************************************************************* * _logb (MSVCRT.@) * @@ -4551,7 +4515,7 @@ double CDECL _logb(double x) return x * x; if (x == 0) return math_error(_SING, "_logb", x, 0, -1 / (x * x)); - return __ilogb(x); + return ilogb(x); } /********************************************************************* @@ -9866,19 +9830,4 @@ double CDECL MSVCR120_creal(_Dcomplex z) return z._Val[0]; } -/********************************************************************* - * ilogb (MSVCR120.@) - */ -int CDECL ilogb(double x) -{ - return __ilogb(x); -} - -/********************************************************************* - * ilogbf (MSVCR120.@) - */ -int CDECL ilogbf(float x) -{ - return __ilogbf(x); -} #endif /* _MSVCR_VER>=120 */ diff --git a/libs/musl/src/math/ilogb.c b/libs/musl/src/math/ilogb.c index 9351411a5aa..12738446ef0 100644 --- a/libs/musl/src/math/ilogb.c +++ b/libs/musl/src/math/ilogb.c @@ -3,7 +3,6 @@ int __cdecl ilogb(double x) { - #pragma STDC FENV_ACCESS ON union {double f; uint64_t i;} u = {x}; uint64_t i = u.i; int e = i>>52 & 0x7ff; @@ -11,7 +10,6 @@ int __cdecl ilogb(double x) if (!e) { i <<= 12; if (i == 0) { - FORCE_EVAL(0/0.0f); return FP_ILOGB0; } /* subnormal x */ @@ -19,7 +17,6 @@ int __cdecl ilogb(double x) return e; } if (e == 0x7ff) { - FORCE_EVAL(0/0.0f); return i<<12 ? FP_ILOGBNAN : INT_MAX; } return e - 0x3ff; diff --git a/libs/musl/src/math/ilogbf.c b/libs/musl/src/math/ilogbf.c index 65ee300531b..2eab40cd1a4 100644 --- a/libs/musl/src/math/ilogbf.c +++ b/libs/musl/src/math/ilogbf.c @@ -3,7 +3,6 @@ int __cdecl ilogbf(float x) { - #pragma STDC FENV_ACCESS ON union {float f; uint32_t i;} u = {x}; uint32_t i = u.i; int e = i>>23 & 0xff; @@ -11,7 +10,6 @@ int __cdecl ilogbf(float x) if (!e) { i <<= 9; if (i == 0) { - FORCE_EVAL(0/0.0f); return FP_ILOGB0; } /* subnormal x */ @@ -19,7 +17,6 @@ int __cdecl ilogbf(float x) return e; } if (e == 0xff) { - FORCE_EVAL(0/0.0f); return i<<9 ? FP_ILOGBNAN : INT_MAX; } return e - 0x7f;
1
0
0
0
Alexandre Julliard : msvcrt: Use the scalbn() implementation from the bundled musl library.
by Alexandre Julliard
05 Apr '23
05 Apr '23
Module: wine Branch: master Commit: 52621691fdadc62113a7edcd45a8a01c50424615 URL:
https://gitlab.winehq.org/wine/wine/-/commit/52621691fdadc62113a7edcd45a8a0…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Apr 3 17:09:52 2023 +0200 msvcrt: Use the scalbn() implementation from the bundled musl library. --- dlls/msvcrt/math.c | 44 ++++++-------------------------------------- 1 file changed, 6 insertions(+), 38 deletions(-) diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index e87441d1427..61c95512448 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -295,38 +295,6 @@ float CDECL _logbf(float x) #endif -/* Copied from musl: src/math/scalbn.c */ -static double __scalbn(double x, int n) -{ - union {double f; UINT64 i;} u; - double y = x; - - if (n > 1023) { - y *= 0x1p1023; - n -= 1023; - if (n > 1023) { - y *= 0x1p1023; - n -= 1023; - if (n > 1023) - n = 1023; - } - } else if (n < -1022) { - /* make sure final n < -53 to avoid double - rounding in the subnormal range */ - y *= 0x1p-1022 * 0x1p53; - n += 1022 - 53; - if (n < -1022) { - y *= 0x1p-1022 * 0x1p53; - n += 1022 - 53; - if (n < -1022) - n = -1022; - } - } - u.i = (UINT64)(0x3ff + n) << 52; - x = y * u.f; - return x; -} - /* Copied from musl: src/math/__rem_pio2_large.c */ static int __rem_pio2_large(double *x, double *y, int e0, int nx, int prec) { @@ -391,7 +359,7 @@ recompute: } /* compute n */ - z = __scalbn(z, q0); /* actual value of z */ + z = scalbn(z, q0); /* actual value of z */ z -= 8.0 * floor(z * 0.125); /* trim off integer >= 8 */ n = (INT32)z; z -= (double)n; @@ -431,7 +399,7 @@ recompute: if (ih == 2) { z = 1.0 - z; if (carry != 0) - z -= __scalbn(1.0, q0); + z -= scalbn(1.0, q0); } } @@ -462,7 +430,7 @@ recompute: q0 -= 24; } } else { /* break z into 24-bit if necessary */ - z = __scalbn(z, -q0); + z = scalbn(z, -q0); if (z >= 0x1p24) { fw = (double)(INT32)(0x1p-24 * z); iq[jz] = (INT32)(z - 0x1p24 * fw); @@ -474,7 +442,7 @@ recompute: } /* convert integer "bit" chunk to floating-point value */ - fw = __scalbn(1.0, q0); + fw = scalbn(1.0, q0); for (i = jz; i >= 0; i--) { q[i] = fw * (double)iq[i]; fw *= 0x1p-24; @@ -4853,7 +4821,7 @@ double CDECL fma( double x, double y, double z ) r = i; } } - return __scalbn(r, e); + return scalbn(r, e); } /********************************************************************* @@ -5338,7 +5306,7 @@ int * CDECL __fpecode(void) */ double CDECL ldexp(double num, int exp) { - double z = __scalbn(num, exp); + double z = scalbn(num, exp); if (isfinite(num) && !isfinite(z)) return math_error(_OVERFLOW, "ldexp", num, exp, z);
1
0
0
0
Alexandre Julliard : msvcrt: Use the nan()/nanf() implementation from the bundled musl library.
by Alexandre Julliard
05 Apr '23
05 Apr '23
Module: wine Branch: master Commit: 0750079ace273e390429b3cfb0dd1f191c6ed828 URL:
https://gitlab.winehq.org/wine/wine/-/commit/0750079ace273e390429b3cfb0dd1f…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Apr 3 17:09:18 2023 +0200 msvcrt: Use the nan()/nanf() implementation from the bundled musl library. --- dlls/msvcrt/math.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index c0d9baab361..e87441d1427 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -9796,23 +9796,6 @@ float CDECL tgammaf(float x) return tgamma(x); } -/********************************************************************* - * nan (MSVCR120.@) - */ -double CDECL nan(const char *tagp) -{ - /* Windows ignores input (MSDN) */ - return NAN; -} - -/********************************************************************* - * nanf (MSVCR120.@) - */ -float CDECL nanf(const char *tagp) -{ - return NAN; -} - /********************************************************************* * _except1 (MSVCR120.@) * TODO:
1
0
0
0
Zebediah Figura : quartz/vmr9: Do not set the mode if we failed to create the default presenter.
by Alexandre Julliard
05 Apr '23
05 Apr '23
Module: wine Branch: master Commit: 4a441e7b41fe1fe5aa548c29b6224ab70b721f56 URL:
https://gitlab.winehq.org/wine/wine/-/commit/4a441e7b41fe1fe5aa548c29b6224a…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Tue Apr 4 13:50:05 2023 -0500 quartz/vmr9: Do not set the mode if we failed to create the default presenter. --- dlls/quartz/vmr9.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 80c2d7bedb9..8eee6587182 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -1352,13 +1352,14 @@ static HRESULT WINAPI VMR9FilterConfig_SetRenderingMode(IVMRFilterConfig9 *iface if (FAILED(hr = default_presenter_create(This, &default_presenter))) { ERR("Failed to create default presenter, hr %#lx.\n", hr); - break; + LeaveCriticalSection(&This->renderer.filter.filter_cs); + return hr; } This->allocator = &default_presenter->IVMRSurfaceAllocator9_iface; This->presenter = &default_presenter->IVMRImagePresenter9_iface; IVMRImagePresenter9_AddRef(This->presenter); - hr = IVMRSurfaceAllocator9_AdviseNotify(This->allocator, &This->IVMRSurfaceAllocatorNotify9_iface); + IVMRSurfaceAllocator9_AdviseNotify(This->allocator, &This->IVMRSurfaceAllocatorNotify9_iface); break; case VMR9Mode_Renderless: break;
1
0
0
0
← Newer
1
...
67
68
69
70
71
72
73
...
82
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Results per page:
10
25
50
100
200