[PATCH v4] include: Add some math declarations.
Daniel Lehman
dlehman25 at gmail.com
Sat Apr 9 11:13:22 CDT 2022
Signed-off-by: Daniel Lehman <dlehman25 at gmail.com>
---
v4: fix build using gcc without mingw
v3: remove incorrect declarations and other unavailable functions
v2: correct some declarations
---
dlls/msvcrt/math.c | 20 ++++++++++----------
include/msvcrt/math.h | 32 +++++++++++++++++++++++++++++---
2 files changed, 39 insertions(+), 13 deletions(-)
diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index 854403a71bf..31200562f00 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -8695,13 +8695,13 @@ __msvcrt_long CDECL lrintf(float x)
/*********************************************************************
* llrint (MSVCR120.@)
*/
-__int64 CDECL llrint(double x)
+long long CDECL llrint(double x)
{
double d;
d = rint(x);
- if ((d < 0 && d != (double)(__int64)d)
- || (d >= 0 && d != (double)(unsigned __int64)d)) {
+ if ((d < 0 && d != (double)(long long)d)
+ || (d >= 0 && d != (double)(unsigned long long)d)) {
*_errno() = EDOM;
return 0;
}
@@ -8711,13 +8711,13 @@ __int64 CDECL llrint(double x)
/*********************************************************************
* llrintf (MSVCR120.@)
*/
-__int64 CDECL llrintf(float x)
+long long CDECL llrintf(float x)
{
float f;
f = rintf(x);
- if ((f < 0 && f != (float)(__int64)f)
- || (f >= 0 && f != (float)(unsigned __int64)f)) {
+ if ((f < 0 && f != (float)(long long)f)
+ || (f >= 0 && f != (float)(unsigned long long)f)) {
*_errno() = EDOM;
return 0;
}
@@ -8798,10 +8798,10 @@ __msvcrt_long CDECL lroundf(float x)
*
* Copied from musl: src/math/llround.c
*/
-__int64 CDECL llround(double x)
+long long CDECL llround(double x)
{
double d = round(x);
- if (d != (double)(__int64)d) {
+ if (d != (double)(long long)d) {
*_errno() = EDOM;
return 0;
}
@@ -8813,10 +8813,10 @@ __int64 CDECL llround(double x)
*
* Copied from musl: src/math/llroundf.c
*/
-__int64 CDECL llroundf(float x)
+long long CDECL llroundf(float x)
{
float f = roundf(x);
- if (f != (float)(__int64)f) {
+ if (f != (float)(long long)f) {
*_errno() = EDOM;
return 0;
}
diff --git a/include/msvcrt/math.h b/include/msvcrt/math.h
index da07303bcd9..97ae6dfe240 100644
--- a/include/msvcrt/math.h
+++ b/include/msvcrt/math.h
@@ -69,12 +69,16 @@ _ACRTIMP double __cdecl fabs(double);
_ACRTIMP double __cdecl ldexp(double, int);
_ACRTIMP double __cdecl frexp(double, int*);
_ACRTIMP double __cdecl modf(double, double*);
+_ACRTIMP double __cdecl fdim(double, double);
_ACRTIMP double __cdecl fmod(double, double);
_ACRTIMP double __cdecl fmin(double, double);
_ACRTIMP double __cdecl fmax(double, double);
_ACRTIMP double __cdecl erf(double);
+_ACRTIMP double __cdecl remainder(double, double);
_ACRTIMP double __cdecl remquo(double, double, int*);
_ACRTIMP float __cdecl remquof(float, float, int*);
+_ACRTIMP double __cdecl lgamma(double);
+_ACRTIMP double __cdecl tgamma(double);
_ACRTIMP double __cdecl _hypot(double, double);
_ACRTIMP double __cdecl _j0(double);
@@ -86,18 +90,31 @@ _ACRTIMP double __cdecl _yn(int, double);
_ACRTIMP double __cdecl cbrt(double);
_ACRTIMP double __cdecl exp2(double);
+_ACRTIMP double __cdecl expm1(double);
+_ACRTIMP double __cdecl log1p(double);
_ACRTIMP double __cdecl log2(double);
+_ACRTIMP double __cdecl logb(double);
_ACRTIMP double __cdecl rint(double);
_ACRTIMP double __cdecl round(double);
_ACRTIMP double __cdecl trunc(double);
_ACRTIMP float __cdecl cbrtf(float);
_ACRTIMP float __cdecl exp2f(float);
+_ACRTIMP float __cdecl expm1f(float);
+_ACRTIMP float __cdecl log1pf(float);
_ACRTIMP float __cdecl log2f(float);
+_ACRTIMP float __cdecl logbf(float);
_ACRTIMP float __cdecl rintf(float);
_ACRTIMP float __cdecl roundf(float);
_ACRTIMP float __cdecl truncf(float);
+_ACRTIMP int __cdecl ilogb(double);
+_ACRTIMP int __cdecl ilogbf(float);
+
+_ACRTIMP long long __cdecl llrint(double);
+_ACRTIMP long long __cdecl llrintf(float);
+_ACRTIMP long long __cdecl llround(double);
+_ACRTIMP long long __cdecl llroundf(float);
_ACRTIMP __msvcrt_long __cdecl lrint(double);
_ACRTIMP __msvcrt_long __cdecl lrintf(float);
_ACRTIMP __msvcrt_long __cdecl lround(double);
@@ -105,6 +122,8 @@ _ACRTIMP __msvcrt_long __cdecl lroundf(float);
_ACRTIMP double __cdecl scalbn(double,int);
_ACRTIMP float __cdecl scalbnf(float,int);
+_ACRTIMP double __cdecl scalbln(double,__msvcrt_long);
+_ACRTIMP float __cdecl scalblnf(float,__msvcrt_long);
_ACRTIMP double __cdecl _copysign (double, double);
_ACRTIMP double __cdecl _chgsign (double);
@@ -115,6 +134,8 @@ _ACRTIMP int __cdecl _finite(double);
_ACRTIMP int __cdecl _isnan(double);
_ACRTIMP int __cdecl _fpclass(double);
+_ACRTIMP double __cdecl nextafter(double, double);
+
#ifndef __i386__
_ACRTIMP float __cdecl sinf(float);
@@ -199,15 +220,20 @@ _ACRTIMP float __cdecl _logbf(float);
_ACRTIMP float __cdecl acoshf(float);
_ACRTIMP float __cdecl asinhf(float);
_ACRTIMP float __cdecl atanhf(float);
+_ACRTIMP float __cdecl erff(float);
+_ACRTIMP float __cdecl fdimf(float, float);
+_ACRTIMP float __cdecl fmaxf(float, float);
+_ACRTIMP float __cdecl fminf(float, float);
+_ACRTIMP float __cdecl lgammaf(float);
+_ACRTIMP float __cdecl nextafterf(float, float);
+_ACRTIMP float __cdecl remainderf(float, float);
+_ACRTIMP float __cdecl tgammaf(float);
#else
static inline float _chgsignf(float x) { return _chgsign(x); }
static inline float _copysignf(float x, float y) { return _copysign(x, y); }
static inline float _logbf(float x) { return _logb(x); }
-static inline float acoshf(float x) { return acosh(x); }
-static inline float asinhf(float x) { return asinh(x); }
-static inline float atanhf(float x) { return atanh(x); }
#endif
--
2.25.1
More information about the wine-devel
mailing list