2 * mingwex/Makefile.in (MATH_DISTFILES): Remove pow.c,
(MATH_OBJS): Remove pow,o. * include/math.h (pow): Declare with _CRTIMP. Add comment on how to avoid excess precision problems.
This commit is contained in:
parent
2cb47d686e
commit
64b9893f0d
|
@ -1,3 +1,10 @@
|
|||
2004-07-02 Danny Smith <dannysmith@users.sourceforge.net>
|
||||
|
||||
* mingwex/Makefile.in (MATH_DISTFILES): Remove pow.c,
|
||||
(MATH_OBJS): Remove pow,o.
|
||||
* include/math.h (pow): Declare with _CRTIMP.
|
||||
Add comment on how to avoid excess precision problems.
|
||||
|
||||
2004-06-30 Danny Smith <dannysmith@users.sourceforge.net>
|
||||
|
||||
* include/stdio.h (__mingw_fseeko64): Add prototype.
|
||||
|
|
|
@ -129,7 +129,6 @@ struct _exception
|
|||
double retval;
|
||||
};
|
||||
|
||||
|
||||
_CRTIMP double __cdecl sin (double);
|
||||
_CRTIMP double __cdecl cos (double);
|
||||
_CRTIMP double __cdecl tan (double);
|
||||
|
@ -143,10 +142,7 @@ _CRTIMP double __cdecl atan2 (double, double);
|
|||
_CRTIMP double __cdecl exp (double);
|
||||
_CRTIMP double __cdecl log (double);
|
||||
_CRTIMP double __cdecl log10 (double);
|
||||
#ifdef __NO_ISOCEXT
|
||||
_CRTIMP
|
||||
#endif
|
||||
double __cdecl pow (double, double);
|
||||
_CRTIMP double __cdecl pow (double, double);
|
||||
_CRTIMP double __cdecl sqrt (double);
|
||||
_CRTIMP double __cdecl ceil (double);
|
||||
_CRTIMP double __cdecl floor (double);
|
||||
|
@ -156,6 +152,44 @@ _CRTIMP double __cdecl frexp (double, int*);
|
|||
_CRTIMP double __cdecl modf (double, double*);
|
||||
_CRTIMP double __cdecl fmod (double, double);
|
||||
|
||||
/* Excess precision when using a 64-bit mantissa for FPU math ops can
|
||||
cause unexpected results with some of the MSVCRT math functions. For
|
||||
example, unless the function return value is stored (truncating to
|
||||
53-bit mantissa), calls to pow with both x and y as integral values
|
||||
sometimes produce a non-integral result.
|
||||
One workaround is to reset the FPU env to 53-bit mantissa
|
||||
by a call to fesetenv (FE_PC53_ENV). Amother is to force storage
|
||||
of the return value of individual math functions using wrappers.
|
||||
NB, using these wrappers will disable builtin math functions and
|
||||
hence disable the folding of function results at compile time when
|
||||
arguments are constant. */
|
||||
|
||||
#if 0
|
||||
#define __DEFINE_FLOAT_STORE_MATHFN_D1(fn1) \
|
||||
static __inline__ double \
|
||||
__float_store_ ## fn1 (double x) \
|
||||
{ \
|
||||
__volatile__ double res = (fn1) (x); \
|
||||
return res; \
|
||||
}
|
||||
|
||||
#define __DEFINE_FLOAT_STORE_MATHFN_D2(fn2) \
|
||||
static __inline__ double \
|
||||
__float_store_ ## fn2 (double x, double y) \
|
||||
{ \
|
||||
__volatile__ double res = (fn2) (x, y); \
|
||||
return res; \
|
||||
}
|
||||
#endif
|
||||
|
||||
/* For example, here is how to force the result of the pow function
|
||||
to be stored: */
|
||||
#if 0
|
||||
#undef pow
|
||||
/* Define the ___float_store_pow function and use it instead of pow(). */
|
||||
__DEFINE_FLOAT_STORE_MATHFN_D2 (pow)
|
||||
#define pow __float_store_pow
|
||||
#endif
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ MATH_DISTFILES = \
|
|||
log2l.S logb.c logbf.c logbl.c logf.S logl.S lrint.c lrintf.c \
|
||||
lrintl.c lround.c lroundf.c lroundl.c modff.c modfl.c \
|
||||
nearbyint.S nearbyintf.S nearbyintl.S nextafterf.c \
|
||||
pow.c powf.c powi.c powif.c powil.c powl.c \
|
||||
powf.c powi.c powif.c powil.c powl.c \
|
||||
remainder.S remainderf.S remainderl.S remquo.S \
|
||||
remquof.S remquol.S rint.c rintf.c rintl.c round.c roundf.c \
|
||||
roundl.c scalbn.S scalbnf.S scalbnl.S s_erf.c sf_erf.c \
|
||||
|
@ -135,7 +135,7 @@ MATH_OBJS = \
|
|||
log2l.o logb.o logbf.o logbl.o logf.o logl.o lrint.o lrintf.o \
|
||||
lrintl.o lround.o lroundf.o lroundl.o modff.o modfl.o \
|
||||
nearbyint.o nearbyintf.o nearbyintl.o nextafterf.o \
|
||||
pow.o powf.o powi.o powif.o powil.o powl.o \
|
||||
powf.o powi.o powif.o powil.o powl.o \
|
||||
remainder.o remainderf.o remainderl.o remquo.o \
|
||||
remquof.o remquol.o rint.o rintf.o rintl.o round.o roundf.o \
|
||||
roundl.o scalbn.o scalbnf.o scalbnl.o s_erf.o sf_erf.o \
|
||||
|
|
Loading…
Reference in New Issue