msvcrt: Implemented __control87_2.
[wine.git] / dlls / msvcrt / math.c
blobcb49756b4301fdc38907bca5eb4a1e3f57ac5962
1 /*
2 * msvcrt.dll math functions
4 * Copyright 2000 Jon Griffiths
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "config.h"
22 #include <stdio.h>
23 #define __USE_ISOC9X 1
24 #define __USE_ISOC99 1
25 #include <math.h>
26 #ifdef HAVE_IEEEFP_H
27 #include <ieeefp.h>
28 #endif
30 #include "msvcrt.h"
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
36 #ifndef HAVE_FINITE
37 #ifndef finite /* Could be a macro */
38 #ifdef isfinite
39 #define finite(x) isfinite(x)
40 #else
41 #define finite(x) (!isnan(x)) /* At least catch some cases */
42 #endif
43 #endif
44 #endif
46 #ifndef signbit
47 #define signbit(x) 0
48 #endif
50 typedef int (CDECL *MSVCRT_matherr_func)(struct MSVCRT__exception *);
52 static MSVCRT_matherr_func MSVCRT_default_matherr_func = NULL;
54 static BOOL sse2_supported;
55 static BOOL sse2_enabled;
57 void msvcrt_init_math(void)
59 sse2_supported = sse2_enabled = IsProcessorFeaturePresent( PF_XMMI64_INSTRUCTIONS_AVAILABLE );
62 /*********************************************************************
63 * _set_SSE2_enable (MSVCRT.@)
65 int CDECL MSVCRT__set_SSE2_enable(int flag)
67 sse2_enabled = flag && sse2_supported;
68 return sse2_enabled;
71 #ifdef __x86_64__
73 /*********************************************************************
74 * MSVCRT_acosf (MSVCRT.@)
76 float CDECL MSVCRT_acosf( float x )
78 if (x < -1.0 || x > 1.0 || !finitef(x)) *MSVCRT__errno() = MSVCRT_EDOM;
79 /* glibc implements acos() as the FPU equivalent of atan2(sqrt(1 - x ^ 2), x).
80 * asin() uses a similar construction. This is bad because as x gets nearer to
81 * 1 the error in the expression "1 - x^2" can get relatively large due to
82 * cancellation. The sqrt() makes things worse. A safer way to calculate
83 * acos() is to use atan2(sqrt((1 - x) * (1 + x)), x). */
84 return atan2f(sqrtf((1 - x) * (1 + x)), x);
87 /*********************************************************************
88 * MSVCRT_asinf (MSVCRT.@)
90 float CDECL MSVCRT_asinf( float x )
92 if (x < -1.0 || x > 1.0 || !finitef(x)) *MSVCRT__errno() = MSVCRT_EDOM;
93 return atan2f(x, sqrtf((1 - x) * (1 + x)));
96 /*********************************************************************
97 * MSVCRT_atanf (MSVCRT.@)
99 float CDECL MSVCRT_atanf( float x )
101 if (!finitef(x)) *MSVCRT__errno() = MSVCRT_EDOM;
102 return atanf(x);
105 /*********************************************************************
106 * MSVCRT_atan2f (MSVCRT.@)
108 float CDECL MSVCRT_atan2f( float x, float y )
110 if (!finitef(x)) *MSVCRT__errno() = MSVCRT_EDOM;
111 return atan2f(x,y);
114 /*********************************************************************
115 * MSVCRT_cosf (MSVCRT.@)
117 float CDECL MSVCRT_cosf( float x )
119 if (!finitef(x)) *MSVCRT__errno() = MSVCRT_EDOM;
120 return cosf(x);
123 /*********************************************************************
124 * MSVCRT_coshf (MSVCRT.@)
126 float CDECL MSVCRT_coshf( float x )
128 if (!finitef(x)) *MSVCRT__errno() = MSVCRT_EDOM;
129 return coshf(x);
132 /*********************************************************************
133 * MSVCRT_expf (MSVCRT.@)
135 float CDECL MSVCRT_expf( float x )
137 if (!finitef(x)) *MSVCRT__errno() = MSVCRT_EDOM;
138 return expf(x);
141 /*********************************************************************
142 * MSVCRT_fmodf (MSVCRT.@)
144 float CDECL MSVCRT_fmodf( float x, float y )
146 if (!finitef(x) || !finitef(y)) *MSVCRT__errno() = MSVCRT_EDOM;
147 return fmodf(x,y);
150 /*********************************************************************
151 * MSVCRT_logf (MSVCRT.@)
153 float CDECL MSVCRT_logf( float x)
155 if (x < 0.0 || !finitef(x)) *MSVCRT__errno() = MSVCRT_EDOM;
156 if (x == 0.0) *MSVCRT__errno() = MSVCRT_ERANGE;
157 return logf(x);
160 /*********************************************************************
161 * MSVCRT_log10f (MSVCRT.@)
163 float CDECL MSVCRT_log10f( float x )
165 if (x < 0.0 || !finitef(x)) *MSVCRT__errno() = MSVCRT_EDOM;
166 if (x == 0.0) *MSVCRT__errno() = MSVCRT_ERANGE;
167 return log10f(x);
170 /*********************************************************************
171 * MSVCRT_powf (MSVCRT.@)
173 float CDECL MSVCRT_powf( float x, float y )
175 /* FIXME: If x < 0 and y is not integral, set EDOM */
176 float z = powf(x,y);
177 if (!finitef(z)) *MSVCRT__errno() = MSVCRT_EDOM;
178 return z;
181 /*********************************************************************
182 * MSVCRT_sinf (MSVCRT.@)
184 float CDECL MSVCRT_sinf( float x )
186 if (!finitef(x)) *MSVCRT__errno() = MSVCRT_EDOM;
187 return sinf(x);
190 /*********************************************************************
191 * MSVCRT_sinhf (MSVCRT.@)
193 float CDECL MSVCRT_sinhf( float x )
195 if (!finitef(x)) *MSVCRT__errno() = MSVCRT_EDOM;
196 return sinhf(x);
199 /*********************************************************************
200 * MSVCRT_sqrtf (MSVCRT.@)
202 float CDECL MSVCRT_sqrtf( float x )
204 if (x < 0.0 || !finitef(x)) *MSVCRT__errno() = MSVCRT_EDOM;
205 return sqrtf(x);
208 /*********************************************************************
209 * MSVCRT_tanf (MSVCRT.@)
211 float CDECL MSVCRT_tanf( float x )
213 if (!finitef(x)) *MSVCRT__errno() = MSVCRT_EDOM;
214 return tanf(x);
217 /*********************************************************************
218 * MSVCRT_tanhf (MSVCRT.@)
220 float CDECL MSVCRT_tanhf( float x )
222 if (!finitef(x)) *MSVCRT__errno() = MSVCRT_EDOM;
223 return tanhf(x);
226 /*********************************************************************
227 * ceilf (MSVCRT.@)
229 float CDECL MSVCRT_ceilf( float x )
231 return ceilf(x);
234 /*********************************************************************
235 * floorf (MSVCRT.@)
237 float CDECL MSVCRT_floorf( float x )
239 return floorf(x);
242 /*********************************************************************
243 * frexpf (MSVCRT.@)
245 float CDECL MSVCRT_frexpf( float x, int *exp )
247 return frexpf( x, exp );
250 /*********************************************************************
251 * _scalbf (MSVCRT.@)
253 float CDECL MSVCRT__scalbf(float num, MSVCRT_long power)
255 if (!finitef(num)) *MSVCRT__errno() = MSVCRT_EDOM;
256 return ldexpf(num, power);
259 /*********************************************************************
260 * modff (MSVCRT.@)
262 double CDECL MSVCRT_modff( float x, float *iptr )
264 return modff( x, iptr );
267 #endif
269 /*********************************************************************
270 * MSVCRT_acos (MSVCRT.@)
272 double CDECL MSVCRT_acos( double x )
274 if (x < -1.0 || x > 1.0 || !finite(x)) *MSVCRT__errno() = MSVCRT_EDOM;
275 /* glibc implements acos() as the FPU equivalent of atan2(sqrt(1 - x ^ 2), x).
276 * asin() uses a similar construction. This is bad because as x gets nearer to
277 * 1 the error in the expression "1 - x^2" can get relatively large due to
278 * cancellation. The sqrt() makes things worse. A safer way to calculate
279 * acos() is to use atan2(sqrt((1 - x) * (1 + x)), x). */
280 return atan2(sqrt((1 - x) * (1 + x)), x);
283 /*********************************************************************
284 * MSVCRT_asin (MSVCRT.@)
286 double CDECL MSVCRT_asin( double x )
288 if (x < -1.0 || x > 1.0 || !finite(x)) *MSVCRT__errno() = MSVCRT_EDOM;
289 return atan2(x, sqrt((1 - x) * (1 + x)));
292 /*********************************************************************
293 * MSVCRT_atan (MSVCRT.@)
295 double CDECL MSVCRT_atan( double x )
297 if (!finite(x)) *MSVCRT__errno() = MSVCRT_EDOM;
298 return atan(x);
301 /*********************************************************************
302 * MSVCRT_atan2 (MSVCRT.@)
304 double CDECL MSVCRT_atan2( double x, double y )
306 if (!finite(x)) *MSVCRT__errno() = MSVCRT_EDOM;
307 return atan2(x,y);
310 /*********************************************************************
311 * MSVCRT_cos (MSVCRT.@)
313 double CDECL MSVCRT_cos( double x )
315 if (!finite(x)) *MSVCRT__errno() = MSVCRT_EDOM;
316 return cos(x);
319 /*********************************************************************
320 * MSVCRT_cosh (MSVCRT.@)
322 double CDECL MSVCRT_cosh( double x )
324 if (!finite(x)) *MSVCRT__errno() = MSVCRT_EDOM;
325 return cosh(x);
328 /*********************************************************************
329 * MSVCRT_exp (MSVCRT.@)
331 double CDECL MSVCRT_exp( double x )
333 if (!finite(x)) *MSVCRT__errno() = MSVCRT_EDOM;
334 return exp(x);
337 /*********************************************************************
338 * MSVCRT_fmod (MSVCRT.@)
340 double CDECL MSVCRT_fmod( double x, double y )
342 if (!finite(x) || !finite(y)) *MSVCRT__errno() = MSVCRT_EDOM;
343 return fmod(x,y);
346 /*********************************************************************
347 * MSVCRT_log (MSVCRT.@)
349 double CDECL MSVCRT_log( double x)
351 if (x < 0.0 || !finite(x)) *MSVCRT__errno() = MSVCRT_EDOM;
352 if (x == 0.0) *MSVCRT__errno() = MSVCRT_ERANGE;
353 return log(x);
356 /*********************************************************************
357 * MSVCRT_log10 (MSVCRT.@)
359 double CDECL MSVCRT_log10( double x )
361 if (x < 0.0 || !finite(x)) *MSVCRT__errno() = MSVCRT_EDOM;
362 if (x == 0.0) *MSVCRT__errno() = MSVCRT_ERANGE;
363 return log10(x);
366 /*********************************************************************
367 * MSVCRT_pow (MSVCRT.@)
369 double CDECL MSVCRT_pow( double x, double y )
371 /* FIXME: If x < 0 and y is not integral, set EDOM */
372 double z = pow(x,y);
373 if (!finite(z)) *MSVCRT__errno() = MSVCRT_EDOM;
374 return z;
377 /*********************************************************************
378 * MSVCRT_sin (MSVCRT.@)
380 double CDECL MSVCRT_sin( double x )
382 if (!finite(x)) *MSVCRT__errno() = MSVCRT_EDOM;
383 return sin(x);
386 /*********************************************************************
387 * MSVCRT_sinh (MSVCRT.@)
389 double CDECL MSVCRT_sinh( double x )
391 if (!finite(x)) *MSVCRT__errno() = MSVCRT_EDOM;
392 return sinh(x);
395 /*********************************************************************
396 * MSVCRT_sqrt (MSVCRT.@)
398 double CDECL MSVCRT_sqrt( double x )
400 if (x < 0.0 || !finite(x)) *MSVCRT__errno() = MSVCRT_EDOM;
401 return sqrt(x);
404 /*********************************************************************
405 * MSVCRT_tan (MSVCRT.@)
407 double CDECL MSVCRT_tan( double x )
409 if (!finite(x)) *MSVCRT__errno() = MSVCRT_EDOM;
410 return tan(x);
413 /*********************************************************************
414 * MSVCRT_tanh (MSVCRT.@)
416 double CDECL MSVCRT_tanh( double x )
418 if (!finite(x)) *MSVCRT__errno() = MSVCRT_EDOM;
419 return tanh(x);
423 #if defined(__GNUC__) && defined(__i386__)
425 #define FPU_DOUBLE(var) double var; \
426 __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var) : )
427 #define FPU_DOUBLES(var1,var2) double var1,var2; \
428 __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var2) : ); \
429 __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var1) : )
431 /*********************************************************************
432 * _CIacos (MSVCRT.@)
434 double CDECL _CIacos(void)
436 FPU_DOUBLE(x);
437 return MSVCRT_acos(x);
440 /*********************************************************************
441 * _CIasin (MSVCRT.@)
443 double CDECL _CIasin(void)
445 FPU_DOUBLE(x);
446 return MSVCRT_asin(x);
449 /*********************************************************************
450 * _CIatan (MSVCRT.@)
452 double CDECL _CIatan(void)
454 FPU_DOUBLE(x);
455 return MSVCRT_atan(x);
458 /*********************************************************************
459 * _CIatan2 (MSVCRT.@)
461 double CDECL _CIatan2(void)
463 FPU_DOUBLES(x,y);
464 return MSVCRT_atan2(x,y);
467 /*********************************************************************
468 * _CIcos (MSVCRT.@)
470 double CDECL _CIcos(void)
472 FPU_DOUBLE(x);
473 return MSVCRT_cos(x);
476 /*********************************************************************
477 * _CIcosh (MSVCRT.@)
479 double CDECL _CIcosh(void)
481 FPU_DOUBLE(x);
482 return MSVCRT_cosh(x);
485 /*********************************************************************
486 * _CIexp (MSVCRT.@)
488 double CDECL _CIexp(void)
490 FPU_DOUBLE(x);
491 return MSVCRT_exp(x);
494 /*********************************************************************
495 * _CIfmod (MSVCRT.@)
497 double CDECL _CIfmod(void)
499 FPU_DOUBLES(x,y);
500 return MSVCRT_fmod(x,y);
503 /*********************************************************************
504 * _CIlog (MSVCRT.@)
506 double CDECL _CIlog(void)
508 FPU_DOUBLE(x);
509 return MSVCRT_log(x);
512 /*********************************************************************
513 * _CIlog10 (MSVCRT.@)
515 double CDECL _CIlog10(void)
517 FPU_DOUBLE(x);
518 return MSVCRT_log10(x);
521 /*********************************************************************
522 * _CIpow (MSVCRT.@)
524 double CDECL _CIpow(void)
526 FPU_DOUBLES(x,y);
527 return MSVCRT_pow(x,y);
530 /*********************************************************************
531 * _CIsin (MSVCRT.@)
533 double CDECL _CIsin(void)
535 FPU_DOUBLE(x);
536 return MSVCRT_sin(x);
539 /*********************************************************************
540 * _CIsinh (MSVCRT.@)
542 double CDECL _CIsinh(void)
544 FPU_DOUBLE(x);
545 return MSVCRT_sinh(x);
548 /*********************************************************************
549 * _CIsqrt (MSVCRT.@)
551 double CDECL _CIsqrt(void)
553 FPU_DOUBLE(x);
554 return MSVCRT_sqrt(x);
557 /*********************************************************************
558 * _CItan (MSVCRT.@)
560 double CDECL _CItan(void)
562 FPU_DOUBLE(x);
563 return MSVCRT_tan(x);
566 /*********************************************************************
567 * _CItanh (MSVCRT.@)
569 double CDECL _CItanh(void)
571 FPU_DOUBLE(x);
572 return MSVCRT_tanh(x);
575 #endif /* defined(__GNUC__) && defined(__i386__) */
577 /*********************************************************************
578 * _fpclass (MSVCRT.@)
580 int CDECL _fpclass(double num)
582 #if defined(HAVE_FPCLASS) || defined(fpclass)
583 switch (fpclass( num ))
585 #ifdef FP_SNAN
586 case FP_SNAN: return MSVCRT__FPCLASS_SNAN;
587 #endif
588 #ifdef FP_QNAN
589 case FP_QNAN: return MSVCRT__FPCLASS_QNAN;
590 #endif
591 #ifdef FP_NINF
592 case FP_NINF: return MSVCRT__FPCLASS_NINF;
593 #endif
594 #ifdef FP_PINF
595 case FP_PINF: return MSVCRT__FPCLASS_PINF;
596 #endif
597 #ifdef FP_NDENORM
598 case FP_NDENORM: return MSVCRT__FPCLASS_ND;
599 #endif
600 #ifdef FP_PDENORM
601 case FP_PDENORM: return MSVCRT__FPCLASS_PD;
602 #endif
603 #ifdef FP_NZERO
604 case FP_NZERO: return MSVCRT__FPCLASS_NZ;
605 #endif
606 #ifdef FP_PZERO
607 case FP_PZERO: return MSVCRT__FPCLASS_PZ;
608 #endif
609 #ifdef FP_NNORM
610 case FP_NNORM: return MSVCRT__FPCLASS_NN;
611 #endif
612 #ifdef FP_PNORM
613 case FP_PNORM: return MSVCRT__FPCLASS_PN;
614 #endif
615 default: return MSVCRT__FPCLASS_PN;
617 #elif defined (fpclassify)
618 switch (fpclassify( num ))
620 case FP_NAN: return MSVCRT__FPCLASS_QNAN;
621 case FP_INFINITE: return signbit(num) ? MSVCRT__FPCLASS_NINF : MSVCRT__FPCLASS_PINF;
622 case FP_SUBNORMAL: return signbit(num) ?MSVCRT__FPCLASS_ND : MSVCRT__FPCLASS_PD;
623 case FP_ZERO: return signbit(num) ? MSVCRT__FPCLASS_NZ : MSVCRT__FPCLASS_PZ;
625 return signbit(num) ? MSVCRT__FPCLASS_NN : MSVCRT__FPCLASS_PN;
626 #else
627 if (!finite(num))
628 return MSVCRT__FPCLASS_QNAN;
629 return num == 0.0 ? MSVCRT__FPCLASS_PZ : (num < 0 ? MSVCRT__FPCLASS_NN : MSVCRT__FPCLASS_PN);
630 #endif
633 /*********************************************************************
634 * _rotl (MSVCRT.@)
636 unsigned int CDECL _rotl(unsigned int num, int shift)
638 shift &= 31;
639 return (num << shift) | (num >> (32-shift));
642 /*********************************************************************
643 * _logb (MSVCRT.@)
645 double CDECL _logb(double num)
647 if (!finite(num)) *MSVCRT__errno() = MSVCRT_EDOM;
648 return logb(num);
651 /*********************************************************************
652 * _lrotl (MSVCRT.@)
654 MSVCRT_ulong CDECL MSVCRT__lrotl(MSVCRT_ulong num, int shift)
656 shift &= 0x1f;
657 return (num << shift) | (num >> (32-shift));
660 /*********************************************************************
661 * _lrotr (MSVCRT.@)
663 MSVCRT_ulong CDECL MSVCRT__lrotr(MSVCRT_ulong num, int shift)
665 shift &= 0x1f;
666 return (num >> shift) | (num << (32-shift));
669 /*********************************************************************
670 * _rotr (MSVCRT.@)
672 unsigned int CDECL _rotr(unsigned int num, int shift)
674 shift &= 0x1f;
675 return (num >> shift) | (num << (32-shift));
678 /*********************************************************************
679 * _scalb (MSVCRT.@)
681 double CDECL MSVCRT__scalb(double num, MSVCRT_long power)
683 if (!finite(num)) *MSVCRT__errno() = MSVCRT_EDOM;
684 return ldexp(num, power);
687 /*********************************************************************
688 * _hypot (MSVCRT.@)
690 double CDECL _hypot(double x, double y)
692 /* FIXME: errno handling */
693 return hypot( x, y );
696 /*********************************************************************
697 * _hypotf (MSVCRT.@)
699 float CDECL _hypotf(float x, float y)
701 /* FIXME: errno handling */
702 return hypotf( x, y );
705 /*********************************************************************
706 * ceil (MSVCRT.@)
708 double CDECL MSVCRT_ceil( double x )
710 return ceil(x);
713 /*********************************************************************
714 * floor (MSVCRT.@)
716 double CDECL MSVCRT_floor( double x )
718 return floor(x);
721 /*********************************************************************
722 * fabs (MSVCRT.@)
724 double CDECL MSVCRT_fabs( double x )
726 return fabs(x);
729 /*********************************************************************
730 * frexp (MSVCRT.@)
732 double CDECL MSVCRT_frexp( double x, int *exp )
734 return frexp( x, exp );
737 /*********************************************************************
738 * modf (MSVCRT.@)
740 double CDECL MSVCRT_modf( double x, double *iptr )
742 return modf( x, iptr );
745 /*********************************************************************
746 * _matherr (MSVCRT.@)
748 int CDECL MSVCRT__matherr(struct MSVCRT__exception *e)
750 if (e)
751 TRACE("(%p = %d, %s, %g %g %g)\n",e, e->type, e->name, e->arg1, e->arg2,
752 e->retval);
753 else
754 TRACE("(null)\n");
755 if (MSVCRT_default_matherr_func)
756 return MSVCRT_default_matherr_func(e);
757 ERR(":Unhandled math error!\n");
758 return 0;
761 /*********************************************************************
762 * __setusermatherr (MSVCRT.@)
764 void CDECL MSVCRT___setusermatherr(MSVCRT_matherr_func func)
766 MSVCRT_default_matherr_func = func;
767 TRACE(":new matherr handler %p\n", func);
770 /**********************************************************************
771 * _statusfp (MSVCRT.@)
773 unsigned int CDECL _statusfp(void)
775 unsigned int retVal = 0;
776 #if defined(__GNUC__) && defined(__i386__)
777 unsigned int fpword;
779 __asm__ __volatile__( "fstsw %0" : "=m" (fpword) : );
780 if (fpword & 0x1) retVal |= MSVCRT__SW_INVALID;
781 if (fpword & 0x2) retVal |= MSVCRT__SW_DENORMAL;
782 if (fpword & 0x4) retVal |= MSVCRT__SW_ZERODIVIDE;
783 if (fpword & 0x8) retVal |= MSVCRT__SW_OVERFLOW;
784 if (fpword & 0x10) retVal |= MSVCRT__SW_UNDERFLOW;
785 if (fpword & 0x20) retVal |= MSVCRT__SW_INEXACT;
786 #else
787 FIXME(":Not implemented!\n");
788 #endif
789 return retVal;
792 /*********************************************************************
793 * _clearfp (MSVCRT.@)
795 unsigned int CDECL _clearfp(void)
797 unsigned int retVal = _statusfp();
798 #if defined(__GNUC__) && defined(__i386__)
799 __asm__ __volatile__( "fnclex" );
800 #else
801 FIXME(":Not Implemented\n");
802 #endif
803 return retVal;
806 /*********************************************************************
807 * __fpecode (MSVCRT.@)
809 int * CDECL __fpecode(void)
811 return &msvcrt_get_thread_data()->fpecode;
814 /*********************************************************************
815 * ldexp (MSVCRT.@)
817 double CDECL MSVCRT_ldexp(double num, MSVCRT_long exp)
819 double z = ldexp(num,exp);
821 if (!finite(z))
822 *MSVCRT__errno() = MSVCRT_ERANGE;
823 else if (z == 0 && signbit(z))
824 z = 0.0; /* Convert -0 -> +0 */
825 return z;
828 /*********************************************************************
829 * _cabs (MSVCRT.@)
831 double CDECL MSVCRT__cabs(struct MSVCRT__complex num)
833 return sqrt(num.x * num.x + num.y * num.y);
836 /*********************************************************************
837 * _chgsign (MSVCRT.@)
839 double CDECL _chgsign(double num)
841 /* FIXME: +-infinity,Nan not tested */
842 return -num;
845 /*********************************************************************
846 * __control87_2 (MSVCRT.@)
848 * Not exported by native msvcrt, added in msvcr80.
850 #if defined(__i386__) || defined(__x86_64__)
851 int CDECL __control87_2( unsigned int newval, unsigned int mask,
852 unsigned int *x86_cw, unsigned int *sse2_cw )
854 #ifdef __GNUC__
855 unsigned long fpword;
856 unsigned int flags;
858 if (x86_cw)
860 __asm__ __volatile__( "fstcw %0" : "=m" (fpword) );
862 /* Convert into mask constants */
863 flags = 0;
864 if (fpword & 0x1) flags |= MSVCRT__EM_INVALID;
865 if (fpword & 0x2) flags |= MSVCRT__EM_DENORMAL;
866 if (fpword & 0x4) flags |= MSVCRT__EM_ZERODIVIDE;
867 if (fpword & 0x8) flags |= MSVCRT__EM_OVERFLOW;
868 if (fpword & 0x10) flags |= MSVCRT__EM_UNDERFLOW;
869 if (fpword & 0x20) flags |= MSVCRT__EM_INEXACT;
870 switch (fpword & 0xc00)
872 case 0xc00: flags |= MSVCRT__RC_UP|MSVCRT__RC_DOWN; break;
873 case 0x800: flags |= MSVCRT__RC_UP; break;
874 case 0x400: flags |= MSVCRT__RC_DOWN; break;
876 switch (fpword & 0x300)
878 case 0x0: flags |= MSVCRT__PC_24; break;
879 case 0x200: flags |= MSVCRT__PC_53; break;
880 case 0x300: flags |= MSVCRT__PC_64; break;
882 if (fpword & 0x1000) flags |= MSVCRT__IC_AFFINE;
884 TRACE( "x86 flags=%08x newval=%08x mask=%08x\n", flags, newval, mask );
885 if (mask)
887 flags = (flags & ~mask) | (newval & mask);
889 /* Convert (masked) value back to fp word */
890 fpword = 0;
891 if (flags & MSVCRT__EM_INVALID) fpword |= 0x1;
892 if (flags & MSVCRT__EM_DENORMAL) fpword |= 0x2;
893 if (flags & MSVCRT__EM_ZERODIVIDE) fpword |= 0x4;
894 if (flags & MSVCRT__EM_OVERFLOW) fpword |= 0x8;
895 if (flags & MSVCRT__EM_UNDERFLOW) fpword |= 0x10;
896 if (flags & MSVCRT__EM_INEXACT) fpword |= 0x20;
897 switch (flags & MSVCRT__MCW_RC)
899 case MSVCRT__RC_UP|MSVCRT__RC_DOWN: fpword |= 0xc00; break;
900 case MSVCRT__RC_UP: fpword |= 0x800; break;
901 case MSVCRT__RC_DOWN: fpword |= 0x400; break;
903 switch (flags & MSVCRT__MCW_PC)
905 case MSVCRT__PC_64: fpword |= 0x300; break;
906 case MSVCRT__PC_53: fpword |= 0x200; break;
907 case MSVCRT__PC_24: fpword |= 0x0; break;
909 if (flags & MSVCRT__IC_AFFINE) fpword |= 0x1000;
911 __asm__ __volatile__( "fldcw %0" : : "m" (fpword) );
913 *x86_cw = flags;
916 if (!sse2_cw) return 1;
918 if (sse2_supported)
920 __asm__ __volatile__( "stmxcsr %0" : "=m" (fpword) );
922 /* Convert into mask constants */
923 flags = 0;
924 if (fpword & 0x80) flags |= MSVCRT__EM_INVALID;
925 if (fpword & 0x100) flags |= MSVCRT__EM_DENORMAL;
926 if (fpword & 0x200) flags |= MSVCRT__EM_ZERODIVIDE;
927 if (fpword & 0x400) flags |= MSVCRT__EM_OVERFLOW;
928 if (fpword & 0x800) flags |= MSVCRT__EM_UNDERFLOW;
929 if (fpword & 0x1000) flags |= MSVCRT__EM_INEXACT;
930 switch (fpword & 0x6000)
932 case 0x6000: flags |= MSVCRT__RC_UP|MSVCRT__RC_DOWN; break;
933 case 0x4000: flags |= MSVCRT__RC_UP; break;
934 case 0x2000: flags |= MSVCRT__RC_DOWN; break;
936 switch (fpword & 0x8040)
938 case 0x0040: flags |= MSVCRT__DN_FLUSH_OPERANDS_SAVE_RESULTS; break;
939 case 0x8000: flags |= MSVCRT__DN_SAVE_OPERANDS_FLUSH_RESULTS; break;
940 case 0x8040: flags |= MSVCRT__DN_FLUSH; break;
943 TRACE( "sse2 flags=%08x newval=%08x mask=%08x\n", flags, newval, mask );
944 if (mask)
946 flags = (flags & ~mask) | (newval & mask);
948 /* Convert (masked) value back to fp word */
949 fpword = 0;
950 if (flags & MSVCRT__EM_INVALID) fpword |= 0x80;
951 if (flags & MSVCRT__EM_DENORMAL) fpword |= 0x100;
952 if (flags & MSVCRT__EM_ZERODIVIDE) fpword |= 0x200;
953 if (flags & MSVCRT__EM_OVERFLOW) fpword |= 0x400;
954 if (flags & MSVCRT__EM_UNDERFLOW) fpword |= 0x800;
955 if (flags & MSVCRT__EM_INEXACT) fpword |= 0x1000;
956 switch (flags & MSVCRT__MCW_RC)
958 case MSVCRT__RC_UP|MSVCRT__RC_DOWN: fpword |= 0x6000; break;
959 case MSVCRT__RC_UP: fpword |= 0x4000; break;
960 case MSVCRT__RC_DOWN: fpword |= 0x2000; break;
962 switch (flags & MSVCRT__MCW_DN)
964 case MSVCRT__DN_FLUSH_OPERANDS_SAVE_RESULTS: fpword |= 0x0040; break;
965 case MSVCRT__DN_SAVE_OPERANDS_FLUSH_RESULTS: fpword |= 0x8000; break;
966 case MSVCRT__DN_FLUSH: fpword |= 0x8040; break;
968 __asm__ __volatile__( "ldmxcsr %0" : : "m" (fpword) );
970 *sse2_cw = flags;
972 else *sse2_cw = 0;
974 return 1;
975 #else
976 FIXME( "not implemented\n" );
977 return 0;
978 #endif
980 #endif
982 /*********************************************************************
983 * _control87 (MSVCRT.@)
985 unsigned int CDECL _control87(unsigned int newval, unsigned int mask)
987 #if defined(__i386__) || defined(__x86_64__)
988 unsigned int x86_cw, sse2_cw;
990 __control87_2( newval, mask, &x86_cw, &sse2_cw );
992 if ((x86_cw ^ sse2_cw) & (MSVCRT__MCW_EM | MSVCRT__MCW_RC)) x86_cw |= MSVCRT__EM_AMBIGUOUS;
993 return x86_cw;
994 #else
995 FIXME( "not implemented\n" );
996 return 0;
997 #endif
1000 /*********************************************************************
1001 * _controlfp (MSVCRT.@)
1003 unsigned int CDECL _controlfp(unsigned int newval, unsigned int mask)
1005 return _control87( newval, mask & ~MSVCRT__EM_DENORMAL );
1008 /*********************************************************************
1009 * _controlfp_s (MSVCRT.@)
1011 int CDECL _controlfp_s(unsigned int *cur, unsigned int newval, unsigned int mask)
1013 static const unsigned int all_flags = (MSVCRT__MCW_EM | MSVCRT__MCW_IC | MSVCRT__MCW_RC |
1014 MSVCRT__MCW_PC | MSVCRT__MCW_DN);
1015 unsigned int val;
1017 if (!MSVCRT_CHECK_PMT( !(newval & mask & ~all_flags) ))
1019 if (cur) *cur = _controlfp( 0, 0 ); /* retrieve it anyway */
1020 *MSVCRT__errno() = MSVCRT_EINVAL;
1021 return MSVCRT_EINVAL;
1023 val = _controlfp( newval, mask );
1024 if (cur) *cur = val;
1025 return 0;
1028 /*********************************************************************
1029 * _copysign (MSVCRT.@)
1031 double CDECL _copysign(double num, double sign)
1033 /* FIXME: Behaviour for Nan/Inf? */
1034 if (sign < 0.0)
1035 return num < 0.0 ? num : -num;
1036 return num < 0.0 ? -num : num;
1039 /*********************************************************************
1040 * _finite (MSVCRT.@)
1042 int CDECL _finite(double num)
1044 return (finite(num)?1:0); /* See comment for _isnan() */
1047 /*********************************************************************
1048 * _fpreset (MSVCRT.@)
1050 void CDECL _fpreset(void)
1052 #if defined(__GNUC__) && defined(__i386__)
1053 __asm__ __volatile__( "fninit" );
1054 #else
1055 FIXME(":Not Implemented!\n");
1056 #endif
1059 /*********************************************************************
1060 * _isnan (MSVCRT.@)
1062 INT CDECL _isnan(double num)
1064 /* Some implementations return -1 for true(glibc), msvcrt/crtdll return 1.
1065 * Do the same, as the result may be used in calculations
1067 return isnan(num) ? 1 : 0;
1070 /*********************************************************************
1071 * _j0 (MSVCRT.@)
1073 double CDECL _j0(double num)
1075 /* FIXME: errno handling */
1076 return j0(num);
1079 /*********************************************************************
1080 * _j1 (MSVCRT.@)
1082 double CDECL _j1(double num)
1084 /* FIXME: errno handling */
1085 return j1(num);
1088 /*********************************************************************
1089 * jn (MSVCRT.@)
1091 double CDECL _jn(int n, double num)
1093 /* FIXME: errno handling */
1094 return jn(n, num);
1097 /*********************************************************************
1098 * _y0 (MSVCRT.@)
1100 double CDECL _y0(double num)
1102 double retval;
1103 if (!finite(num)) *MSVCRT__errno() = MSVCRT_EDOM;
1104 retval = y0(num);
1105 if (_fpclass(retval) == MSVCRT__FPCLASS_NINF)
1107 *MSVCRT__errno() = MSVCRT_EDOM;
1108 retval = sqrt(-1);
1110 return retval;
1113 /*********************************************************************
1114 * _y1 (MSVCRT.@)
1116 double CDECL _y1(double num)
1118 double retval;
1119 if (!finite(num)) *MSVCRT__errno() = MSVCRT_EDOM;
1120 retval = y1(num);
1121 if (_fpclass(retval) == MSVCRT__FPCLASS_NINF)
1123 *MSVCRT__errno() = MSVCRT_EDOM;
1124 retval = sqrt(-1);
1126 return retval;
1129 /*********************************************************************
1130 * _yn (MSVCRT.@)
1132 double CDECL _yn(int order, double num)
1134 double retval;
1135 if (!finite(num)) *MSVCRT__errno() = MSVCRT_EDOM;
1136 retval = yn(order,num);
1137 if (_fpclass(retval) == MSVCRT__FPCLASS_NINF)
1139 *MSVCRT__errno() = MSVCRT_EDOM;
1140 retval = sqrt(-1);
1142 return retval;
1145 /*********************************************************************
1146 * _nextafter (MSVCRT.@)
1148 double CDECL _nextafter(double num, double next)
1150 double retval;
1151 if (!finite(num) || !finite(next)) *MSVCRT__errno() = MSVCRT_EDOM;
1152 retval = nextafter(num,next);
1153 return retval;
1156 /*********************************************************************
1157 * _ecvt (MSVCRT.@)
1159 char * CDECL _ecvt( double number, int ndigits, int *decpt, int *sign )
1161 int prec, len;
1162 thread_data_t *data = msvcrt_get_thread_data();
1163 /* FIXME: check better for overflow (native supports over 300 chars's) */
1164 ndigits = min( ndigits, 80 - 7); /* 7 : space for dec point, 1 for "e",
1165 * 4 for exponent and one for
1166 * terminating '\0' */
1167 if (!data->efcvt_buffer)
1168 data->efcvt_buffer = MSVCRT_malloc( 80 ); /* ought to be enough */
1170 if( number < 0) {
1171 *sign = TRUE;
1172 number = -number;
1173 } else
1174 *sign = FALSE;
1175 /* handle cases with zero ndigits or less */
1176 prec = ndigits;
1177 if( prec < 1) prec = 2;
1178 len = snprintf(data->efcvt_buffer, 80, "%.*le", prec - 1, number);
1179 /* take the decimal "point away */
1180 if( prec != 1)
1181 memmove( data->efcvt_buffer + 1, data->efcvt_buffer + 2, len - 1 );
1182 /* take the exponential "e" out */
1183 data->efcvt_buffer[ prec] = '\0';
1184 /* read the exponent */
1185 sscanf( data->efcvt_buffer + prec + 1, "%d", decpt);
1186 (*decpt)++;
1187 /* adjust for some border cases */
1188 if( data->efcvt_buffer[0] == '0')/* value is zero */
1189 *decpt = 0;
1190 /* handle cases with zero ndigits or less */
1191 if( ndigits < 1){
1192 if( data->efcvt_buffer[ 0] >= '5')
1193 (*decpt)++;
1194 data->efcvt_buffer[ 0] = '\0';
1196 TRACE("out=\"%s\"\n",data->efcvt_buffer);
1197 return data->efcvt_buffer;
1200 /*********************************************************************
1201 * _ecvt_s (MSVCRT.@)
1203 int CDECL _ecvt_s( char *buffer, MSVCRT_size_t length, double number, int ndigits, int *decpt, int *sign )
1205 int prec, len;
1206 char *result;
1207 const char infret[] = "1#INF";
1209 if(!MSVCRT_CHECK_PMT(buffer != NULL) || !MSVCRT_CHECK_PMT(decpt != NULL) || !MSVCRT_CHECK_PMT(sign != NULL))
1211 *MSVCRT__errno() = MSVCRT_EINVAL;
1212 return MSVCRT_EINVAL;
1214 if(!MSVCRT_CHECK_PMT(length > 2) || !MSVCRT_CHECK_PMT(ndigits < (int)length - 1))
1216 *MSVCRT__errno() = MSVCRT_ERANGE;
1217 return MSVCRT_ERANGE;
1220 /* special case - inf */
1221 if(number == HUGE_VAL || number == -HUGE_VAL)
1223 memset(buffer, '0', ndigits);
1224 memcpy(buffer, infret, min(ndigits, sizeof(infret) - 1 ) );
1225 buffer[ndigits] = '\0';
1226 (*decpt) = 1;
1227 if(number == -HUGE_VAL)
1228 (*sign) = 1;
1229 else
1230 (*sign) = 0;
1231 return 0;
1233 result = (char*)MSVCRT_malloc(max(ndigits + 7, 7));
1235 if( number < 0) {
1236 *sign = TRUE;
1237 number = -number;
1238 } else
1239 *sign = FALSE;
1240 /* handle cases with zero ndigits or less */
1241 prec = ndigits;
1242 if( prec < 1) prec = 2;
1243 len = snprintf(result, 80, "%.*le", prec - 1, number);
1244 /* take the decimal "point away */
1245 if( prec != 1)
1246 memmove( result + 1, result + 2, len - 1 );
1247 /* take the exponential "e" out */
1248 result[ prec] = '\0';
1249 /* read the exponent */
1250 sscanf( result + prec + 1, "%d", decpt);
1251 (*decpt)++;
1252 /* adjust for some border cases */
1253 if( result[0] == '0')/* value is zero */
1254 *decpt = 0;
1255 /* handle cases with zero ndigits or less */
1256 if( ndigits < 1){
1257 if( result[ 0] >= '5')
1258 (*decpt)++;
1259 result[ 0] = '\0';
1261 memcpy( buffer, result, max(ndigits + 1, 1) );
1262 MSVCRT_free( result );
1263 return 0;
1266 /***********************************************************************
1267 * _fcvt (MSVCRT.@)
1269 char * CDECL _fcvt( double number, int ndigits, int *decpt, int *sign )
1271 thread_data_t *data = msvcrt_get_thread_data();
1272 int stop, dec1, dec2;
1273 char *ptr1, *ptr2, *first;
1274 char buf[80]; /* ought to be enough */
1276 if (!data->efcvt_buffer)
1277 data->efcvt_buffer = MSVCRT_malloc( 80 ); /* ought to be enough */
1279 if (number < 0)
1281 *sign = 1;
1282 number = -number;
1283 } else *sign = 0;
1285 snprintf(buf, 80, "%.*f", ndigits < 0 ? 0 : ndigits, number);
1286 ptr1 = buf;
1287 ptr2 = data->efcvt_buffer;
1288 first = NULL;
1289 dec1 = 0;
1290 dec2 = 0;
1292 /* For numbers below the requested resolution, work out where
1293 the decimal point will be rather than finding it in the string */
1294 if (number < 1.0 && number > 0.0) {
1295 dec2 = log10(number + 1e-10);
1296 if (-dec2 <= ndigits) dec2 = 0;
1299 /* If requested digits is zero or less, we will need to truncate
1300 * the returned string */
1301 if (ndigits < 1) {
1302 stop = strlen(buf) + ndigits;
1303 } else {
1304 stop = strlen(buf);
1307 while (*ptr1 == '0') ptr1++; /* Skip leading zeroes */
1308 while (*ptr1 != '\0' && *ptr1 != '.') {
1309 if (!first) first = ptr2;
1310 if ((ptr1 - buf) < stop) {
1311 *ptr2++ = *ptr1++;
1312 } else {
1313 ptr1++;
1315 dec1++;
1318 if (ndigits > 0) {
1319 ptr1++;
1320 if (!first) {
1321 while (*ptr1 == '0') { /* Process leading zeroes */
1322 *ptr2++ = *ptr1++;
1323 dec1--;
1326 while (*ptr1 != '\0') {
1327 if (!first) first = ptr2;
1328 *ptr2++ = *ptr1++;
1332 *ptr2 = '\0';
1334 /* We never found a non-zero digit, then our number is either
1335 * smaller than the requested precision, or 0.0 */
1336 if (!first) {
1337 if (number > 0.0) {
1338 first = ptr2;
1339 } else {
1340 first = data->efcvt_buffer;
1341 dec1 = 0;
1345 *decpt = dec2 ? dec2 : dec1;
1346 return first;
1349 /***********************************************************************
1350 * _gcvt (MSVCRT.@)
1352 char * CDECL _gcvt( double number, int ndigit, char *buff )
1354 if(!buff) {
1355 *MSVCRT__errno() = MSVCRT_EINVAL;
1356 return NULL;
1359 if(ndigit < 0) {
1360 *MSVCRT__errno() = MSVCRT_ERANGE;
1361 return NULL;
1364 MSVCRT_sprintf(buff, "%.*g", ndigit, number);
1365 return buff;
1368 /***********************************************************************
1369 * _gcvt_s (MSVCRT.@)
1371 int CDECL _gcvt_s(char *buff, MSVCRT_size_t size, double number, int digits)
1373 int len;
1375 if(!buff) {
1376 *MSVCRT__errno() = MSVCRT_EINVAL;
1377 return MSVCRT_EINVAL;
1380 if( digits<0 || digits>=size) {
1381 if(size)
1382 buff[0] = '\0';
1384 *MSVCRT__errno() = MSVCRT_ERANGE;
1385 return MSVCRT_ERANGE;
1388 len = MSVCRT__scprintf("%.*g", digits, number);
1389 if(len > size) {
1390 buff[0] = '\0';
1391 *MSVCRT__errno() = MSVCRT_ERANGE;
1392 return MSVCRT_ERANGE;
1395 MSVCRT_sprintf(buff, "%.*g", digits, number);
1396 return 0;
1399 #include <stdlib.h> /* div_t, ldiv_t */
1401 /*********************************************************************
1402 * div (MSVCRT.@)
1403 * VERSION
1404 * [i386] Windows binary compatible - returns the struct in eax/edx.
1406 #ifdef __i386__
1407 unsigned __int64 CDECL MSVCRT_div(int num, int denom)
1409 div_t dt = div(num,denom);
1410 return ((unsigned __int64)dt.rem << 32) | (unsigned int)dt.quot;
1412 #else
1413 /*********************************************************************
1414 * div (MSVCRT.@)
1415 * VERSION
1416 * [!i386] Non-x86 can't run win32 apps so we don't need binary compatibility
1418 MSVCRT_div_t CDECL MSVCRT_div(int num, int denom)
1420 div_t dt = div(num,denom);
1421 MSVCRT_div_t ret;
1422 ret.quot = dt.quot;
1423 ret.rem = dt.rem;
1425 return ret;
1428 #endif /* ifdef __i386__ */
1431 /*********************************************************************
1432 * ldiv (MSVCRT.@)
1433 * VERSION
1434 * [i386] Windows binary compatible - returns the struct in eax/edx.
1436 #ifdef __i386__
1437 unsigned __int64 CDECL MSVCRT_ldiv(MSVCRT_long num, MSVCRT_long denom)
1439 ldiv_t ldt = ldiv(num,denom);
1440 return ((unsigned __int64)ldt.rem << 32) | (MSVCRT_ulong)ldt.quot;
1442 #else
1443 /*********************************************************************
1444 * ldiv (MSVCRT.@)
1445 * VERSION
1446 * [!i386] Non-x86 can't run win32 apps so we don't need binary compatibility
1448 MSVCRT_ldiv_t CDECL MSVCRT_ldiv(MSVCRT_long num, MSVCRT_long denom)
1450 ldiv_t result = ldiv(num,denom);
1452 MSVCRT_ldiv_t ret;
1453 ret.quot = result.quot;
1454 ret.rem = result.rem;
1456 return ret;
1458 #endif /* ifdef __i386__ */
1460 #ifdef __i386__
1462 /*********************************************************************
1463 * _adjust_fdiv (MSVCRT.@)
1464 * Used by the MSVC compiler to work around the Pentium FDIV bug.
1466 int MSVCRT__adjust_fdiv = 0;
1468 /***********************************************************************
1469 * _adj_fdiv_m16i (MSVCRT.@)
1471 * NOTE
1472 * I _think_ this function is intended to work around the Pentium
1473 * fdiv bug.
1475 void __stdcall _adj_fdiv_m16i( short arg )
1477 TRACE("(): stub\n");
1480 /***********************************************************************
1481 * _adj_fdiv_m32 (MSVCRT.@)
1483 * NOTE
1484 * I _think_ this function is intended to work around the Pentium
1485 * fdiv bug.
1487 void __stdcall _adj_fdiv_m32( unsigned int arg )
1489 TRACE("(): stub\n");
1492 /***********************************************************************
1493 * _adj_fdiv_m32i (MSVCRT.@)
1495 * NOTE
1496 * I _think_ this function is intended to work around the Pentium
1497 * fdiv bug.
1499 void __stdcall _adj_fdiv_m32i( int arg )
1501 TRACE("(): stub\n");
1504 /***********************************************************************
1505 * _adj_fdiv_m64 (MSVCRT.@)
1507 * NOTE
1508 * I _think_ this function is intended to work around the Pentium
1509 * fdiv bug.
1511 void __stdcall _adj_fdiv_m64( unsigned __int64 arg )
1513 TRACE("(): stub\n");
1516 /***********************************************************************
1517 * _adj_fdiv_r (MSVCRT.@)
1518 * FIXME
1519 * This function is likely to have the wrong number of arguments.
1521 * NOTE
1522 * I _think_ this function is intended to work around the Pentium
1523 * fdiv bug.
1525 void _adj_fdiv_r(void)
1527 TRACE("(): stub\n");
1530 /***********************************************************************
1531 * _adj_fdivr_m16i (MSVCRT.@)
1533 * NOTE
1534 * I _think_ this function is intended to work around the Pentium
1535 * fdiv bug.
1537 void __stdcall _adj_fdivr_m16i( short arg )
1539 TRACE("(): stub\n");
1542 /***********************************************************************
1543 * _adj_fdivr_m32 (MSVCRT.@)
1545 * NOTE
1546 * I _think_ this function is intended to work around the Pentium
1547 * fdiv bug.
1549 void __stdcall _adj_fdivr_m32( unsigned int arg )
1551 TRACE("(): stub\n");
1554 /***********************************************************************
1555 * _adj_fdivr_m32i (MSVCRT.@)
1557 * NOTE
1558 * I _think_ this function is intended to work around the Pentium
1559 * fdiv bug.
1561 void __stdcall _adj_fdivr_m32i( int arg )
1563 TRACE("(): stub\n");
1566 /***********************************************************************
1567 * _adj_fdivr_m64 (MSVCRT.@)
1569 * NOTE
1570 * I _think_ this function is intended to work around the Pentium
1571 * fdiv bug.
1573 void __stdcall _adj_fdivr_m64( unsigned __int64 arg )
1575 TRACE("(): stub\n");
1578 /***********************************************************************
1579 * _adj_fpatan (MSVCRT.@)
1580 * FIXME
1581 * This function is likely to have the wrong number of arguments.
1583 * NOTE
1584 * I _think_ this function is intended to work around the Pentium
1585 * fdiv bug.
1587 void _adj_fpatan(void)
1589 TRACE("(): stub\n");
1592 /***********************************************************************
1593 * _adj_fprem (MSVCRT.@)
1594 * FIXME
1595 * This function is likely to have the wrong number of arguments.
1597 * NOTE
1598 * I _think_ this function is intended to work around the Pentium
1599 * fdiv bug.
1601 void _adj_fprem(void)
1603 TRACE("(): stub\n");
1606 /***********************************************************************
1607 * _adj_fprem1 (MSVCRT.@)
1608 * FIXME
1609 * This function is likely to have the wrong number of arguments.
1611 * NOTE
1612 * I _think_ this function is intended to work around the Pentium
1613 * fdiv bug.
1615 void _adj_fprem1(void)
1617 TRACE("(): stub\n");
1620 /***********************************************************************
1621 * _adj_fptan (MSVCRT.@)
1622 * FIXME
1623 * This function is likely to have the wrong number of arguments.
1625 * NOTE
1626 * I _think_ this function is intended to work around the Pentium
1627 * fdiv bug.
1629 void _adj_fptan(void)
1631 TRACE("(): stub\n");
1634 /***********************************************************************
1635 * _safe_fdiv (MSVCRT.@)
1636 * FIXME
1637 * This function is likely to have the wrong number of arguments.
1639 * NOTE
1640 * I _think_ this function is intended to work around the Pentium
1641 * fdiv bug.
1643 void _safe_fdiv(void)
1645 TRACE("(): stub\n");
1648 /***********************************************************************
1649 * _safe_fdivr (MSVCRT.@)
1650 * FIXME
1651 * This function is likely to have the wrong number of arguments.
1653 * NOTE
1654 * I _think_ this function is intended to work around the Pentium
1655 * fdiv bug.
1657 void _safe_fdivr(void)
1659 TRACE("(): stub\n");
1662 /***********************************************************************
1663 * _safe_fprem (MSVCRT.@)
1664 * FIXME
1665 * This function is likely to have the wrong number of arguments.
1667 * NOTE
1668 * I _think_ this function is intended to work around the Pentium
1669 * fdiv bug.
1671 void _safe_fprem(void)
1673 TRACE("(): stub\n");
1676 /***********************************************************************
1677 * _safe_fprem1 (MSVCRT.@)
1679 * FIXME
1680 * This function is likely to have the wrong number of arguments.
1682 * NOTE
1683 * I _think_ this function is intended to work around the Pentium
1684 * fdiv bug.
1686 void _safe_fprem1(void)
1688 TRACE("(): stub\n");
1691 #endif /* __i386__ */