Commit 547ba7a1 authored by Martin Storsjo's avatar Martin Storsjo Committed by Alexandre Julliard

msvcr120: Implement more C99 math functions.

parent 589f58d8
......@@ -16345,8 +16345,6 @@ $as_echo "#define HAVE_ISFINITE 1" >>confdefs.h
fi
ac_save_LIBS="$LIBS"
LIBS="$LIBS -lm"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for isinf" >&5
$as_echo_n "checking for isinf... " >&6; }
if ${ac_cv_have_isinf+:} false; then :
......@@ -16412,6 +16410,40 @@ then
$as_echo "#define HAVE_ISNAN 1" >>confdefs.h
fi
for ac_func in \
cbrt \
cbrtf \
exp2 \
exp2f \
llrint \
llrintf \
llround \
llroundf \
log2 \
log2f \
lrint \
lrintf \
lround \
lroundf \
rint \
rintf \
round \
roundf \
trunc \
truncf
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
LIBS="$ac_save_LIBS"
......
......@@ -2556,8 +2556,6 @@ then
fi
dnl Check for isinf
ac_save_LIBS="$LIBS"
LIBS="$LIBS -lm"
AC_CACHE_CHECK([for isinf], ac_cv_have_isinf,
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[float f = 0.0; return isinf(f)]])],[ac_cv_have_isinf="yes"],[ac_cv_have_isinf="no"]))
if test "$ac_cv_have_isinf" = "yes"
......@@ -2572,6 +2570,29 @@ if test "$ac_cv_have_isnan" = "yes"
then
AC_DEFINE(HAVE_ISNAN, 1, [Define to 1 if you have the `isnan' function.])
fi
AC_CHECK_FUNCS(\
cbrt \
cbrtf \
exp2 \
exp2f \
llrint \
llrintf \
llround \
llroundf \
log2 \
log2f \
lrint \
lrintf \
lround \
lroundf \
rint \
rintf \
round \
roundf \
trunc \
truncf
)
LIBS="$ac_save_LIBS"
dnl *** check for the need to define platform-specific symbols
......
......@@ -2058,9 +2058,9 @@
@ stub catanhf
@ stub catanhl
@ stub catanl
@ stub cbrt
@ stub cbrtf
@ stub cbrtl
@ cdecl cbrt(double) MSVCR120_cbrt
@ cdecl cbrtf(float) MSVCR120_cbrtf
@ cdecl cbrtl(double) MSVCR120_cbrtl
@ stub ccos
@ stub ccosf
@ stub ccosh
......@@ -2127,9 +2127,9 @@
@ stub erfl
@ cdecl exit(long) MSVCRT_exit
@ cdecl exp(double) MSVCRT_exp
@ stub exp2
@ stub exp2f
@ stub exp2l
@ cdecl exp2(double) MSVCR120_exp2
@ cdecl exp2f(float) MSVCR120_exp2f
@ cdecl exp2l(double) MSVCR120_exp2l
@ cdecl -arch=arm,x86_64 expf(float) MSVCRT_expf
@ stub expm1
@ stub expm1f
......@@ -2245,12 +2245,12 @@
@ stub lgammal
@ cdecl -ret64 llabs(int64) MSVCRT_llabs
@ stub lldiv
@ stub llrint
@ stub llrintf
@ stub llrintl
@ stub llround
@ stub llroundf
@ stub llroundl
@ cdecl -ret64 llrint(double) MSVCR120_llrint
@ cdecl -ret64 llrintf(float) MSVCR120_llrintf
@ cdecl -ret64 llrintl(double) MSVCR120_llrintl
@ cdecl -ret64 llround(double) MSVCR120_llround
@ cdecl -ret64 llroundf(float) MSVCR120_llroundf
@ cdecl -ret64 llroundl(double) MSVCR120_llroundl
@ cdecl localeconv() MSVCRT_localeconv
@ cdecl log(double) MSVCRT_log
@ cdecl -arch=arm,x86_64 logf(float) MSVCRT_logf
......@@ -2259,19 +2259,19 @@
@ stub log1p
@ stub log1pf
@ stub log1pl
@ stub log2
@ stub log2f
@ stub log2l
@ cdecl log2(double) MSVCR120_log2
@ cdecl log2f(float) MSVCR120_log2f
@ cdecl log2l(double) MSVCR120_log2l
@ stub logb
@ stub logbf
@ stub logbl
@ cdecl -arch=i386,x86_64,arm longjmp(ptr long) MSVCRT_longjmp
@ stub lrint
@ stub lrintf
@ stub lrintl
@ stub lround
@ stub lroundf
@ stub lroundl
@ cdecl lrint(double) MSVCR120_lrint
@ cdecl lrintf(float) MSVCR120_lrintf
@ cdecl lrintl(double) MSVCR120_lrintl
@ cdecl lround(double) MSVCR120_lround
@ cdecl lroundf(float) MSVCR120_lroundf
@ cdecl lroundl(double) MSVCR120_lroundl
@ cdecl malloc(long) MSVCRT_malloc
@ cdecl mblen(ptr long) MSVCRT_mblen
@ cdecl mbrlen(ptr long ptr) MSVCRT_mbrlen
......@@ -2330,12 +2330,12 @@
@ stub remquol
@ cdecl rename(str str) MSVCRT_rename
@ cdecl rewind(ptr) MSVCRT_rewind
@ stub rint
@ stub rintf
@ stub rintl
@ stub round
@ stub roundf
@ stub roundl
@ cdecl rint(double) MSVCR120_rint
@ cdecl rintf(float) MSVCR120_rintf
@ cdecl rintl(double) MSVCR120_rintl
@ cdecl round(double) MSVCR120_round
@ cdecl roundf(float) MSVCR120_roundf
@ cdecl roundl(double) MSVCR120_roundl
@ stub scalbln
@ stub scalblnf
@ stub scalblnl
......@@ -2414,9 +2414,9 @@
@ stub towctrans
@ cdecl towlower(long) MSVCRT_towlower
@ cdecl towupper(long) MSVCRT_towupper
@ stub trunc
@ stub truncf
@ stub truncl
@ cdecl trunc(double) MSVCR120_trunc
@ cdecl truncf(float) MSVCR120_truncf
@ cdecl truncl(double) MSVCR120_truncl
@ cdecl ungetc(long ptr) MSVCRT_ungetc
@ cdecl ungetwc(long ptr) MSVCRT_ungetwc
@ cdecl vfprintf(ptr str ptr) MSVCRT_vfprintf
......
......@@ -39,6 +39,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
#endif
typedef int (CDECL *MSVCRT_matherr_func)(struct MSVCRT__exception *);
typedef double LDOUBLE; /* long double is just a double */
static MSVCRT_matherr_func MSVCRT_default_matherr_func = NULL;
......@@ -2205,3 +2206,323 @@ void __cdecl __libm_sse2_sqrt_precise(void)
}
#endif /* __i386__ */
/*********************************************************************
* cbrt (MSVCR120.@)
*/
double CDECL MSVCR120_cbrt(double x)
{
#ifdef HAVE_CBRT
return cbrt(x);
#else
return x < 0 ? -pow(-x, 1.0 / 3.0) : pow(x, 1.0 / 3.0);
#endif
}
/*********************************************************************
* cbrtf (MSVCR120.@)
*/
float CDECL MSVCR120_cbrtf(float x)
{
#ifdef HAVE_CBRTF
return cbrtf(x);
#else
return MSVCR120_cbrt(x);
#endif
}
/*********************************************************************
* cbrtl (MSVCR120.@)
*/
LDOUBLE CDECL MSVCR120_cbrtl(LDOUBLE x)
{
return MSVCR120_cbrt(x);
}
/*********************************************************************
* exp2 (MSVCR120.@)
*/
double CDECL MSVCR120_exp2(double x)
{
#ifdef HAVE_EXP2
return exp2(x);
#else
return pow(2, x);
#endif
}
/*********************************************************************
* exp2f (MSVCR120.@)
*/
float CDECL MSVCR120_exp2f(float x)
{
#ifdef HAVE_EXP2F
return exp2f(x);
#else
return MSVCR120_exp2(x);
#endif
}
/*********************************************************************
* exp2l (MSVCR120.@)
*/
LDOUBLE CDECL MSVCR120_exp2l(LDOUBLE x)
{
return MSVCR120_exp2(x);
}
/*********************************************************************
* log2 (MSVCR120.@)
*/
double CDECL MSVCR120_log2(double x)
{
#ifdef HAVE_LOG2
return log2(x);
#else
return log(x) / log(2);
#endif
}
/*********************************************************************
* log2f (MSVCR120.@)
*/
float CDECL MSVCR120_log2f(float x)
{
#ifdef HAVE_LOG2F
return log2f(x);
#else
return MSVCR120_log2(x);
#endif
}
/*********************************************************************
* log2l (MSVCR120.@)
*/
LDOUBLE CDECL MSVCR120_log2l(LDOUBLE x)
{
return MSVCR120_log2(x);
}
/*********************************************************************
* rint (MSVCR120.@)
*/
double CDECL MSVCR120_rint(double x)
{
#ifdef HAVE_RINT
return rint(x);
#else
return x >= 0 ? floor(x + 0.5) : ceil(x - 0.5);
#endif
}
/*********************************************************************
* rintf (MSVCR120.@)
*/
float CDECL MSVCR120_rintf(float x)
{
#ifdef HAVE_RINTF
return rintf(x);
#else
return MSVCR120_rint(x);
#endif
}
/*********************************************************************
* rintl (MSVCR120.@)
*/
LDOUBLE CDECL MSVCR120_rintl(LDOUBLE x)
{
return MSVCR120_rint(x);
}
/*********************************************************************
* lrint (MSVCR120.@)
*/
MSVCRT_long CDECL MSVCR120_lrint(double x)
{
#ifdef HAVE_LRINT
return lrint(x);
#else
return MSVCR120_rint(x);
#endif
}
/*********************************************************************
* lrintf (MSVCR120.@)
*/
MSVCRT_long CDECL MSVCR120_lrintf(float x)
{
#ifdef HAVE_LRINTF
return lrintf(x);
#else
return MSVCR120_lrint(x);
#endif
}
/*********************************************************************
* lrintl (MSVCR120.@)
*/
MSVCRT_long CDECL MSVCR120_lrintl(LDOUBLE x)
{
return MSVCR120_lrint(x);
}
/*********************************************************************
* llrint (MSVCR120.@)
*/
MSVCRT_longlong CDECL MSVCR120_llrint(double x)
{
#ifdef HAVE_LLRINT
return llrint(x);
#else
return MSVCR120_rint(x);
#endif
}
/*********************************************************************
* llrintf (MSVCR120.@)
*/
MSVCRT_longlong CDECL MSVCR120_llrintf(float x)
{
#ifdef HAVE_LLRINTF
return llrintf(x);
#else
return MSVCR120_llrint(x);
#endif
}
/*********************************************************************
* rintl (MSVCR120.@)
*/
MSVCRT_longlong CDECL MSVCR120_llrintl(LDOUBLE x)
{
return MSVCR120_llrint(x);
}
/*********************************************************************
* round (MSVCR120.@)
*/
double CDECL MSVCR120_round(double x)
{
#ifdef HAVE_ROUND
return round(x);
#else
return MSVCR120_rint(x);
#endif
}
/*********************************************************************
* roundf (MSVCR120.@)
*/
float CDECL MSVCR120_roundf(float x)
{
#ifdef HAVE_ROUNDF
return roundf(x);
#else
return MSVCR120_round(x);
#endif
}
/*********************************************************************
* roundl (MSVCR120.@)
*/
LDOUBLE CDECL MSVCR120_roundl(LDOUBLE x)
{
return MSVCR120_round(x);
}
/*********************************************************************
* lround (MSVCR120.@)
*/
MSVCRT_long CDECL MSVCR120_lround(double x)
{
#ifdef HAVE_LROUND
return lround(x);
#else
return MSVCR120_round(x);
#endif
}
/*********************************************************************
* lroundf (MSVCR120.@)
*/
MSVCRT_long CDECL MSVCR120_lroundf(float x)
{
#ifdef HAVE_LROUNDF
return lroundf(x);
#else
return MSVCR120_lround(x);
#endif
}
/*********************************************************************
* lroundl (MSVCR120.@)
*/
MSVCRT_long CDECL MSVCR120_lroundl(LDOUBLE x)
{
return MSVCR120_lround(x);
}
/*********************************************************************
* llround (MSVCR120.@)
*/
MSVCRT_longlong CDECL MSVCR120_llround(double x)
{
#ifdef HAVE_LLROUND
return llround(x);
#else
return MSVCR120_round(x);
#endif
}
/*********************************************************************
* llroundf (MSVCR120.@)
*/
MSVCRT_longlong CDECL MSVCR120_llroundf(float x)
{
#ifdef HAVE_LLROUNDF
return llroundf(x);
#else
return MSVCR120_llround(x);
#endif
}
/*********************************************************************
* roundl (MSVCR120.@)
*/
MSVCRT_longlong CDECL MSVCR120_llroundl(LDOUBLE x)
{
return MSVCR120_llround(x);
}
/*********************************************************************
* trunc (MSVCR120.@)
*/
double CDECL MSVCR120_trunc(double x)
{
#ifdef HAVE_TRUNC
return trunc(x);
#else
return (x > 0) ? floor(x) : ceil(x);
#endif
}
/*********************************************************************
* truncf (MSVCR120.@)
*/
float CDECL MSVCR120_truncf(float x)
{
#ifdef HAVE_TRUNCF
return truncf(x);
#else
return MSVCR120_trunc(x);
#endif
}
/*********************************************************************
* truncl (MSVCR120.@)
*/
LDOUBLE CDECL MSVCR120_truncl(LDOUBLE x)
{
return MSVCR120_trunc(x);
}
......@@ -56,6 +56,12 @@
/* Define to 1 if you have the <Carbon/Carbon.h> header file. */
#undef HAVE_CARBON_CARBON_H
/* Define to 1 if you have the `cbrt' function. */
#undef HAVE_CBRT
/* Define to 1 if you have the `cbrtf' function. */
#undef HAVE_CBRTF
/* Define to 1 if you have the `chsize' function. */
#undef HAVE_CHSIZE
......@@ -105,6 +111,12 @@
/* Define to 1 if you have the `epoll_create' function. */
#undef HAVE_EPOLL_CREATE
/* Define to 1 if you have the `exp2' function. */
#undef HAVE_EXP2
/* Define to 1 if you have the `exp2f' function. */
#undef HAVE_EXP2F
/* Define to 1 if you have the `fallocate' function. */
#undef HAVE_FALLOCATE
......@@ -426,9 +438,39 @@
/* Define to 1 if you have the <linux/videodev.h> header file. */
#undef HAVE_LINUX_VIDEODEV_H
/* Define to 1 if you have the `llrint' function. */
#undef HAVE_LLRINT
/* Define to 1 if you have the `llrintf' function. */
#undef HAVE_LLRINTF
/* Define to 1 if you have the `llround' function. */
#undef HAVE_LLROUND
/* Define to 1 if you have the `llroundf' function. */
#undef HAVE_LLROUNDF
/* Define to 1 if you have the `log2' function. */
#undef HAVE_LOG2
/* Define to 1 if you have the `log2f' function. */
#undef HAVE_LOG2F
/* Define to 1 if the system has the type `long long'. */
#undef HAVE_LONG_LONG
/* Define to 1 if you have the `lrint' function. */
#undef HAVE_LRINT
/* Define to 1 if you have the `lrintf' function. */
#undef HAVE_LRINTF
/* Define to 1 if you have the `lround' function. */
#undef HAVE_LROUND
/* Define to 1 if you have the `lroundf' function. */
#undef HAVE_LROUNDF
/* Define to 1 if you have the `lstat' function. */
#undef HAVE_LSTAT
......@@ -663,6 +705,18 @@
/* Define to 1 if you have the <resolv.h> header file. */
#undef HAVE_RESOLV_H
/* Define to 1 if you have the `rint' function. */
#undef HAVE_RINT
/* Define to 1 if you have the `rintf' function. */
#undef HAVE_RINTF
/* Define to 1 if you have the `round' function. */
#undef HAVE_ROUND
/* Define to 1 if you have the `roundf' function. */
#undef HAVE_ROUNDF
/* Define to 1 if you have the <sched.h> header file. */
#undef HAVE_SCHED_H
......@@ -1083,6 +1137,12 @@
/* Define if you have the timezone variable */
#undef HAVE_TIMEZONE
/* Define to 1 if you have the `trunc' function. */
#undef HAVE_TRUNC
/* Define to 1 if you have the `truncf' function. */
#undef HAVE_TRUNCF
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
......
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