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
21 #include "wine/port.h"
24 #define __USE_ISOC9X 1
25 #define __USE_ISOC99 1
33 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(msvcrt
);
38 #define finitef(x) isfinite(x)
43 #define isnanf(x) isnan(x)
49 /* FIXME: Does not work with -NAN and -0. */
51 #define signbit(x) ((x) < 0)
54 typedef int (CDECL
*MSVCRT_matherr_func
)(struct MSVCRT__exception
*);
55 typedef double LDOUBLE
; /* long double is just a double */
57 static MSVCRT_matherr_func MSVCRT_default_matherr_func
= NULL
;
59 static BOOL sse2_supported
;
60 static BOOL sse2_enabled
;
62 void msvcrt_init_math(void)
64 sse2_supported
= sse2_enabled
= IsProcessorFeaturePresent( PF_XMMI64_INSTRUCTIONS_AVAILABLE
);
67 /*********************************************************************
68 * _set_SSE2_enable (MSVCRT.@)
70 int CDECL
MSVCRT__set_SSE2_enable(int flag
)
72 sse2_enabled
= flag
&& sse2_supported
;
77 /*********************************************************************
78 * _set_FMA3_enable (MSVCR120.@)
80 int CDECL
MSVCRT__set_FMA3_enable(int flag
)
82 FIXME("(%x) stub\n", flag
);
87 #if defined(__x86_64__) || defined(__arm__) || _MSVCR_VER>=120
89 /*********************************************************************
90 * _chgsignf (MSVCRT.@)
92 float CDECL
MSVCRT__chgsignf( float num
)
94 /* FIXME: +-infinity,Nan not tested */
98 /*********************************************************************
99 * _copysignf (MSVCRT.@)
101 float CDECL
MSVCRT__copysignf( float num
, float sign
)
104 return signbit(num
) ? num
: -num
;
105 return signbit(num
) ? -num
: num
;
108 /*********************************************************************
109 * _nextafterf (MSVCRT.@)
111 float CDECL
MSVCRT__nextafterf( float num
, float next
)
113 if (!finitef(num
) || !finitef(next
)) *MSVCRT__errno() = MSVCRT_EDOM
;
114 return nextafterf( num
, next
);
118 #if defined(__x86_64__) || defined(__arm__)
120 /*********************************************************************
121 * _finitef (MSVCRT.@)
123 int CDECL
MSVCRT__finitef( float num
)
125 return finitef(num
) != 0; /* See comment for _isnan() */
128 /*********************************************************************
131 INT CDECL
MSVCRT__isnanf( float num
)
133 /* Some implementations return -1 for true(glibc), msvcrt/crtdll return 1.
134 * Do the same, as the result may be used in calculations
136 return isnanf(num
) != 0;
139 /*********************************************************************
142 float CDECL
MSVCRT__logbf( float num
)
144 if (!finitef(num
)) *MSVCRT__errno() = MSVCRT_EDOM
;
148 /*********************************************************************
149 * MSVCRT_acosf (MSVCRT.@)
151 float CDECL
MSVCRT_acosf( float x
)
153 if (x
< -1.0 || x
> 1.0 || !finitef(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
154 /* glibc implements acos() as the FPU equivalent of atan2(sqrt(1 - x ^ 2), x).
155 * asin() uses a similar construction. This is bad because as x gets nearer to
156 * 1 the error in the expression "1 - x^2" can get relatively large due to
157 * cancellation. The sqrt() makes things worse. A safer way to calculate
158 * acos() is to use atan2(sqrt((1 - x) * (1 + x)), x). */
159 return atan2f(sqrtf((1 - x
) * (1 + x
)), x
);
162 /*********************************************************************
163 * MSVCRT_asinf (MSVCRT.@)
165 float CDECL
MSVCRT_asinf( float x
)
167 if (x
< -1.0 || x
> 1.0 || !finitef(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
168 return atan2f(x
, sqrtf((1 - x
) * (1 + x
)));
171 /*********************************************************************
172 * MSVCRT_atanf (MSVCRT.@)
174 float CDECL
MSVCRT_atanf( float x
)
176 if (!finitef(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
180 /*********************************************************************
181 * MSVCRT_atan2f (MSVCRT.@)
183 float CDECL
MSVCRT_atan2f( float x
, float y
)
185 if (!finitef(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
189 /*********************************************************************
190 * MSVCRT_cosf (MSVCRT.@)
192 float CDECL
MSVCRT_cosf( float x
)
194 if (!finitef(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
198 /*********************************************************************
199 * MSVCRT_coshf (MSVCRT.@)
201 float CDECL
MSVCRT_coshf( float x
)
203 if (!finitef(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
207 /*********************************************************************
208 * MSVCRT_expf (MSVCRT.@)
210 float CDECL
MSVCRT_expf( float x
)
212 if (!finitef(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
216 /*********************************************************************
217 * MSVCRT_fmodf (MSVCRT.@)
219 float CDECL
MSVCRT_fmodf( float x
, float y
)
221 if (!finitef(x
) || !finitef(y
)) *MSVCRT__errno() = MSVCRT_EDOM
;
225 /*********************************************************************
226 * MSVCRT_logf (MSVCRT.@)
228 float CDECL
MSVCRT_logf( float x
)
230 if (x
< 0.0 || !finitef(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
231 if (x
== 0.0) *MSVCRT__errno() = MSVCRT_ERANGE
;
235 /*********************************************************************
236 * MSVCRT_log10f (MSVCRT.@)
238 float CDECL
MSVCRT_log10f( float x
)
240 if (x
< 0.0 || !finitef(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
241 if (x
== 0.0) *MSVCRT__errno() = MSVCRT_ERANGE
;
245 /*********************************************************************
246 * MSVCRT_powf (MSVCRT.@)
248 float CDECL
MSVCRT_powf( float x
, float y
)
250 /* FIXME: If x < 0 and y is not integral, set EDOM */
252 if (!finitef(z
)) *MSVCRT__errno() = MSVCRT_EDOM
;
256 /*********************************************************************
257 * MSVCRT_sinf (MSVCRT.@)
259 float CDECL
MSVCRT_sinf( float x
)
261 if (!finitef(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
265 /*********************************************************************
266 * MSVCRT_sinhf (MSVCRT.@)
268 float CDECL
MSVCRT_sinhf( float x
)
270 if (!finitef(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
274 /*********************************************************************
275 * MSVCRT_sqrtf (MSVCRT.@)
277 float CDECL
MSVCRT_sqrtf( float x
)
279 if (x
< 0.0 || !finitef(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
283 /*********************************************************************
284 * MSVCRT_tanf (MSVCRT.@)
286 float CDECL
MSVCRT_tanf( float x
)
288 if (!finitef(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
292 /*********************************************************************
293 * MSVCRT_tanhf (MSVCRT.@)
295 float CDECL
MSVCRT_tanhf( float x
)
297 if (!finitef(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
301 /*********************************************************************
304 float CDECL
MSVCRT_ceilf( float x
)
309 /*********************************************************************
312 float CDECL
MSVCRT_fabsf( float x
)
317 /*********************************************************************
320 float CDECL
MSVCRT_floorf( float x
)
325 /*********************************************************************
328 float CDECL
MSVCRT_frexpf( float x
, int *exp
)
330 return frexpf( x
, exp
);
333 /*********************************************************************
336 float CDECL
MSVCRT_modff( float x
, float *iptr
)
338 return modff( x
, iptr
);
343 /*********************************************************************
344 * MSVCRT_acos (MSVCRT.@)
346 double CDECL
MSVCRT_acos( double x
)
348 if (x
< -1.0 || x
> 1.0 || !isfinite(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
349 /* glibc implements acos() as the FPU equivalent of atan2(sqrt(1 - x ^ 2), x).
350 * asin() uses a similar construction. This is bad because as x gets nearer to
351 * 1 the error in the expression "1 - x^2" can get relatively large due to
352 * cancellation. The sqrt() makes things worse. A safer way to calculate
353 * acos() is to use atan2(sqrt((1 - x) * (1 + x)), x). */
354 return atan2(sqrt((1 - x
) * (1 + x
)), x
);
357 /*********************************************************************
358 * MSVCRT_asin (MSVCRT.@)
360 double CDECL
MSVCRT_asin( double x
)
362 if (x
< -1.0 || x
> 1.0 || !isfinite(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
363 return atan2(x
, sqrt((1 - x
) * (1 + x
)));
366 /*********************************************************************
367 * MSVCRT_atan (MSVCRT.@)
369 double CDECL
MSVCRT_atan( double x
)
371 if (isnan(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
375 /*********************************************************************
376 * MSVCRT_atan2 (MSVCRT.@)
378 double CDECL
MSVCRT_atan2( double x
, double y
)
380 if (!isfinite(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
384 /*********************************************************************
385 * MSVCRT_cos (MSVCRT.@)
387 double CDECL
MSVCRT_cos( double x
)
389 if (!isfinite(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
393 /*********************************************************************
394 * MSVCRT_cosh (MSVCRT.@)
396 double CDECL
MSVCRT_cosh( double x
)
398 if (!isfinite(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
402 /*********************************************************************
403 * MSVCRT_exp (MSVCRT.@)
405 double CDECL
MSVCRT_exp( double x
)
407 if (isnan(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
411 /*********************************************************************
412 * MSVCRT_fmod (MSVCRT.@)
414 double CDECL
MSVCRT_fmod( double x
, double y
)
416 if (!isfinite(x
) || !isfinite(y
)) *MSVCRT__errno() = MSVCRT_EDOM
;
420 /*********************************************************************
421 * MSVCRT_log (MSVCRT.@)
423 double CDECL
MSVCRT_log( double x
)
425 if (x
< 0.0 || !isfinite(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
426 if (x
== 0.0) *MSVCRT__errno() = MSVCRT_ERANGE
;
430 /*********************************************************************
431 * MSVCRT_log10 (MSVCRT.@)
433 double CDECL
MSVCRT_log10( double x
)
435 if (x
< 0.0 || !isfinite(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
436 if (x
== 0.0) *MSVCRT__errno() = MSVCRT_ERANGE
;
440 /*********************************************************************
441 * MSVCRT_pow (MSVCRT.@)
443 double CDECL
MSVCRT_pow( double x
, double y
)
445 /* FIXME: If x < 0 and y is not integral, set EDOM */
447 if (!isfinite(z
)) *MSVCRT__errno() = MSVCRT_EDOM
;
451 /*********************************************************************
452 * MSVCRT_sin (MSVCRT.@)
454 double CDECL
MSVCRT_sin( double x
)
456 if (!isfinite(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
460 /*********************************************************************
461 * MSVCRT_sinh (MSVCRT.@)
463 double CDECL
MSVCRT_sinh( double x
)
465 if (!isfinite(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
469 /*********************************************************************
470 * MSVCRT_sqrt (MSVCRT.@)
472 double CDECL
MSVCRT_sqrt( double x
)
474 if (x
< 0.0 || !isfinite(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
478 /*********************************************************************
479 * MSVCRT_tan (MSVCRT.@)
481 double CDECL
MSVCRT_tan( double x
)
483 if (!isfinite(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
487 /*********************************************************************
488 * MSVCRT_tanh (MSVCRT.@)
490 double CDECL
MSVCRT_tanh( double x
)
492 if (isnan(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
497 #if defined(__GNUC__) && defined(__i386__)
499 #define FPU_DOUBLE(var) double var; \
500 __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var) : )
501 #define FPU_DOUBLES(var1,var2) double var1,var2; \
502 __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var2) : ); \
503 __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var1) : )
505 /*********************************************************************
508 double CDECL
_CIacos(void)
511 return MSVCRT_acos(x
);
514 /*********************************************************************
517 double CDECL
_CIasin(void)
520 return MSVCRT_asin(x
);
523 /*********************************************************************
526 double CDECL
_CIatan(void)
529 return MSVCRT_atan(x
);
532 /*********************************************************************
533 * _CIatan2 (MSVCRT.@)
535 double CDECL
_CIatan2(void)
538 return MSVCRT_atan2(x
,y
);
541 /*********************************************************************
544 double CDECL
_CIcos(void)
547 return MSVCRT_cos(x
);
550 /*********************************************************************
553 double CDECL
_CIcosh(void)
556 return MSVCRT_cosh(x
);
559 /*********************************************************************
562 double CDECL
_CIexp(void)
565 return MSVCRT_exp(x
);
568 /*********************************************************************
571 double CDECL
_CIfmod(void)
574 return MSVCRT_fmod(x
,y
);
577 /*********************************************************************
580 double CDECL
_CIlog(void)
583 return MSVCRT_log(x
);
586 /*********************************************************************
587 * _CIlog10 (MSVCRT.@)
589 double CDECL
_CIlog10(void)
592 return MSVCRT_log10(x
);
595 /*********************************************************************
598 double CDECL
_CIpow(void)
601 return MSVCRT_pow(x
,y
);
604 /*********************************************************************
607 double CDECL
_CIsin(void)
610 return MSVCRT_sin(x
);
613 /*********************************************************************
616 double CDECL
_CIsinh(void)
619 return MSVCRT_sinh(x
);
622 /*********************************************************************
625 double CDECL
_CIsqrt(void)
628 return MSVCRT_sqrt(x
);
631 /*********************************************************************
634 double CDECL
_CItan(void)
637 return MSVCRT_tan(x
);
640 /*********************************************************************
643 double CDECL
_CItanh(void)
646 return MSVCRT_tanh(x
);
649 /*********************************************************************
652 LONGLONG CDECL
MSVCRT__ftol(void)
658 #endif /* defined(__GNUC__) && defined(__i386__) */
660 /*********************************************************************
661 * _fpclass (MSVCRT.@)
663 int CDECL
MSVCRT__fpclass(double num
)
665 #if defined(HAVE_FPCLASS) || defined(fpclass)
666 switch (fpclass( num
))
668 case FP_SNAN
: return MSVCRT__FPCLASS_SNAN
;
669 case FP_QNAN
: return MSVCRT__FPCLASS_QNAN
;
670 case FP_NINF
: return MSVCRT__FPCLASS_NINF
;
671 case FP_PINF
: return MSVCRT__FPCLASS_PINF
;
672 case FP_NDENORM
: return MSVCRT__FPCLASS_ND
;
673 case FP_PDENORM
: return MSVCRT__FPCLASS_PD
;
674 case FP_NZERO
: return MSVCRT__FPCLASS_NZ
;
675 case FP_PZERO
: return MSVCRT__FPCLASS_PZ
;
676 case FP_NNORM
: return MSVCRT__FPCLASS_NN
;
677 case FP_PNORM
: return MSVCRT__FPCLASS_PN
;
678 default: return MSVCRT__FPCLASS_PN
;
680 #elif defined (fpclassify)
681 switch (fpclassify( num
))
683 case FP_NAN
: return MSVCRT__FPCLASS_QNAN
;
684 case FP_INFINITE
: return signbit(num
) ? MSVCRT__FPCLASS_NINF
: MSVCRT__FPCLASS_PINF
;
685 case FP_SUBNORMAL
: return signbit(num
) ?MSVCRT__FPCLASS_ND
: MSVCRT__FPCLASS_PD
;
686 case FP_ZERO
: return signbit(num
) ? MSVCRT__FPCLASS_NZ
: MSVCRT__FPCLASS_PZ
;
688 return signbit(num
) ? MSVCRT__FPCLASS_NN
: MSVCRT__FPCLASS_PN
;
691 return MSVCRT__FPCLASS_QNAN
;
692 return num
== 0.0 ? MSVCRT__FPCLASS_PZ
: (num
< 0 ? MSVCRT__FPCLASS_NN
: MSVCRT__FPCLASS_PN
);
696 /*********************************************************************
699 unsigned int CDECL
_rotl(unsigned int num
, int shift
)
702 return (num
<< shift
) | (num
>> (32-shift
));
705 /*********************************************************************
708 MSVCRT_ulong CDECL
MSVCRT__lrotl(MSVCRT_ulong num
, int shift
)
711 return (num
<< shift
) | (num
>> (32-shift
));
714 /*********************************************************************
717 MSVCRT_ulong CDECL
MSVCRT__lrotr(MSVCRT_ulong num
, int shift
)
720 return (num
>> shift
) | (num
<< (32-shift
));
723 /*********************************************************************
726 unsigned int CDECL
_rotr(unsigned int num
, int shift
)
729 return (num
>> shift
) | (num
<< (32-shift
));
732 /*********************************************************************
735 unsigned __int64 CDECL
_rotl64(unsigned __int64 num
, int shift
)
738 return (num
<< shift
) | (num
>> (64-shift
));
741 /*********************************************************************
744 unsigned __int64 CDECL
_rotr64(unsigned __int64 num
, int shift
)
747 return (num
>> shift
) | (num
<< (64-shift
));
750 /*********************************************************************
753 int CDECL
MSVCRT_abs( int n
)
755 return n
>= 0 ? n
: -n
;
758 /*********************************************************************
761 MSVCRT_long CDECL
MSVCRT_labs( MSVCRT_long n
)
763 return n
>= 0 ? n
: -n
;
766 /*********************************************************************
769 MSVCRT_longlong CDECL
MSVCRT_llabs( MSVCRT_longlong n
)
771 return n
>= 0 ? n
: -n
;
774 /*********************************************************************
777 __int64 CDECL
_abs64( __int64 n
)
779 return n
>= 0 ? n
: -n
;
782 /*********************************************************************
785 double CDECL
MSVCRT__logb(double num
)
787 if (!isfinite(num
)) *MSVCRT__errno() = MSVCRT_EDOM
;
791 /*********************************************************************
794 double CDECL
_hypot(double x
, double y
)
796 /* FIXME: errno handling */
797 return hypot( x
, y
);
800 /*********************************************************************
803 float CDECL
MSVCRT__hypotf(float x
, float y
)
805 /* FIXME: errno handling */
806 return hypotf( x
, y
);
809 /*********************************************************************
812 double CDECL
MSVCRT_ceil( double x
)
817 /*********************************************************************
820 double CDECL
MSVCRT_floor( double x
)
825 /*********************************************************************
828 double CDECL
MSVCRT_fabs( double x
)
833 /*********************************************************************
836 double CDECL
MSVCRT_frexp( double x
, int *exp
)
838 return frexp( x
, exp
);
841 /*********************************************************************
844 double CDECL
MSVCRT_modf( double x
, double *iptr
)
846 return modf( x
, iptr
);
849 /*********************************************************************
850 * _matherr (MSVCRT.@)
852 int CDECL
MSVCRT__matherr(struct MSVCRT__exception
*e
)
855 TRACE("(%p = %d, %s, %g %g %g)\n",e
, e
->type
, e
->name
, e
->arg1
, e
->arg2
,
859 if (MSVCRT_default_matherr_func
)
860 return MSVCRT_default_matherr_func(e
);
861 ERR(":Unhandled math error!\n");
865 /*********************************************************************
866 * __setusermatherr (MSVCRT.@)
868 void CDECL
MSVCRT___setusermatherr(MSVCRT_matherr_func func
)
870 MSVCRT_default_matherr_func
= func
;
871 TRACE(":new matherr handler %p\n", func
);
874 /**********************************************************************
875 * _statusfp2 (MSVCRT.@)
877 * Not exported by native msvcrt, added in msvcr80.
879 #if defined(__i386__) || defined(__x86_64__)
880 void CDECL
_statusfp2( unsigned int *x86_sw
, unsigned int *sse2_sw
)
884 unsigned long fpword
;
888 __asm__
__volatile__( "fstsw %0" : "=m" (fpword
) );
890 if (fpword
& 0x1) flags
|= MSVCRT__SW_INVALID
;
891 if (fpword
& 0x2) flags
|= MSVCRT__SW_DENORMAL
;
892 if (fpword
& 0x4) flags
|= MSVCRT__SW_ZERODIVIDE
;
893 if (fpword
& 0x8) flags
|= MSVCRT__SW_OVERFLOW
;
894 if (fpword
& 0x10) flags
|= MSVCRT__SW_UNDERFLOW
;
895 if (fpword
& 0x20) flags
|= MSVCRT__SW_INEXACT
;
899 if (!sse2_sw
) return;
903 __asm__
__volatile__( "stmxcsr %0" : "=m" (fpword
) );
905 if (fpword
& 0x1) flags
|= MSVCRT__SW_INVALID
;
906 if (fpword
& 0x2) flags
|= MSVCRT__SW_DENORMAL
;
907 if (fpword
& 0x4) flags
|= MSVCRT__SW_ZERODIVIDE
;
908 if (fpword
& 0x8) flags
|= MSVCRT__SW_OVERFLOW
;
909 if (fpword
& 0x10) flags
|= MSVCRT__SW_UNDERFLOW
;
910 if (fpword
& 0x20) flags
|= MSVCRT__SW_INEXACT
;
915 FIXME( "not implemented\n" );
920 /**********************************************************************
921 * _statusfp (MSVCRT.@)
923 unsigned int CDECL
_statusfp(void)
925 #if defined(__i386__) || defined(__x86_64__)
926 unsigned int x86_sw
, sse2_sw
;
928 _statusfp2( &x86_sw
, &sse2_sw
);
929 /* FIXME: there's no definition for ambiguous status, just return all status bits for now */
930 return x86_sw
| sse2_sw
;
932 FIXME( "not implemented\n" );
937 /*********************************************************************
938 * _clearfp (MSVCRT.@)
940 unsigned int CDECL
_clearfp(void)
942 unsigned int flags
= 0;
943 #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
944 unsigned long fpword
;
946 __asm__
__volatile__( "fnstsw %0; fnclex" : "=m" (fpword
) );
947 if (fpword
& 0x1) flags
|= MSVCRT__SW_INVALID
;
948 if (fpword
& 0x2) flags
|= MSVCRT__SW_DENORMAL
;
949 if (fpword
& 0x4) flags
|= MSVCRT__SW_ZERODIVIDE
;
950 if (fpword
& 0x8) flags
|= MSVCRT__SW_OVERFLOW
;
951 if (fpword
& 0x10) flags
|= MSVCRT__SW_UNDERFLOW
;
952 if (fpword
& 0x20) flags
|= MSVCRT__SW_INEXACT
;
956 __asm__
__volatile__( "stmxcsr %0" : "=m" (fpword
) );
957 if (fpword
& 0x1) flags
|= MSVCRT__SW_INVALID
;
958 if (fpword
& 0x2) flags
|= MSVCRT__SW_DENORMAL
;
959 if (fpword
& 0x4) flags
|= MSVCRT__SW_ZERODIVIDE
;
960 if (fpword
& 0x8) flags
|= MSVCRT__SW_OVERFLOW
;
961 if (fpword
& 0x10) flags
|= MSVCRT__SW_UNDERFLOW
;
962 if (fpword
& 0x20) flags
|= MSVCRT__SW_INEXACT
;
964 __asm__
__volatile__( "ldmxcsr %0" : : "m" (fpword
) );
967 FIXME( "not implemented\n" );
972 /*********************************************************************
973 * __fpecode (MSVCRT.@)
975 int * CDECL
__fpecode(void)
977 return &msvcrt_get_thread_data()->fpecode
;
980 /*********************************************************************
983 double CDECL
MSVCRT_ldexp(double num
, MSVCRT_long exp
)
985 double z
= ldexp(num
,exp
);
988 *MSVCRT__errno() = MSVCRT_ERANGE
;
989 else if (z
== 0 && signbit(z
))
990 z
= 0.0; /* Convert -0 -> +0 */
994 /*********************************************************************
997 double CDECL
MSVCRT__cabs(struct MSVCRT__complex num
)
999 return sqrt(num
.x
* num
.x
+ num
.y
* num
.y
);
1002 /*********************************************************************
1003 * _chgsign (MSVCRT.@)
1005 double CDECL
MSVCRT__chgsign(double num
)
1007 /* FIXME: +-infinity,Nan not tested */
1011 /*********************************************************************
1012 * __control87_2 (MSVCRT.@)
1014 * Not exported by native msvcrt, added in msvcr80.
1016 #if defined(__i386__) || defined(__x86_64__)
1017 int CDECL
__control87_2( unsigned int newval
, unsigned int mask
,
1018 unsigned int *x86_cw
, unsigned int *sse2_cw
)
1021 unsigned long fpword
;
1026 __asm__
__volatile__( "fstcw %0" : "=m" (fpword
) );
1028 /* Convert into mask constants */
1030 if (fpword
& 0x1) flags
|= MSVCRT__EM_INVALID
;
1031 if (fpword
& 0x2) flags
|= MSVCRT__EM_DENORMAL
;
1032 if (fpword
& 0x4) flags
|= MSVCRT__EM_ZERODIVIDE
;
1033 if (fpword
& 0x8) flags
|= MSVCRT__EM_OVERFLOW
;
1034 if (fpword
& 0x10) flags
|= MSVCRT__EM_UNDERFLOW
;
1035 if (fpword
& 0x20) flags
|= MSVCRT__EM_INEXACT
;
1036 switch (fpword
& 0xc00)
1038 case 0xc00: flags
|= MSVCRT__RC_UP
|MSVCRT__RC_DOWN
; break;
1039 case 0x800: flags
|= MSVCRT__RC_UP
; break;
1040 case 0x400: flags
|= MSVCRT__RC_DOWN
; break;
1042 switch (fpword
& 0x300)
1044 case 0x0: flags
|= MSVCRT__PC_24
; break;
1045 case 0x200: flags
|= MSVCRT__PC_53
; break;
1046 case 0x300: flags
|= MSVCRT__PC_64
; break;
1048 if (fpword
& 0x1000) flags
|= MSVCRT__IC_AFFINE
;
1050 TRACE( "x86 flags=%08x newval=%08x mask=%08x\n", flags
, newval
, mask
);
1053 flags
= (flags
& ~mask
) | (newval
& mask
);
1055 /* Convert (masked) value back to fp word */
1057 if (flags
& MSVCRT__EM_INVALID
) fpword
|= 0x1;
1058 if (flags
& MSVCRT__EM_DENORMAL
) fpword
|= 0x2;
1059 if (flags
& MSVCRT__EM_ZERODIVIDE
) fpword
|= 0x4;
1060 if (flags
& MSVCRT__EM_OVERFLOW
) fpword
|= 0x8;
1061 if (flags
& MSVCRT__EM_UNDERFLOW
) fpword
|= 0x10;
1062 if (flags
& MSVCRT__EM_INEXACT
) fpword
|= 0x20;
1063 switch (flags
& MSVCRT__MCW_RC
)
1065 case MSVCRT__RC_UP
|MSVCRT__RC_DOWN
: fpword
|= 0xc00; break;
1066 case MSVCRT__RC_UP
: fpword
|= 0x800; break;
1067 case MSVCRT__RC_DOWN
: fpword
|= 0x400; break;
1069 switch (flags
& MSVCRT__MCW_PC
)
1071 case MSVCRT__PC_64
: fpword
|= 0x300; break;
1072 case MSVCRT__PC_53
: fpword
|= 0x200; break;
1073 case MSVCRT__PC_24
: fpword
|= 0x0; break;
1075 if (flags
& MSVCRT__IC_AFFINE
) fpword
|= 0x1000;
1077 __asm__
__volatile__( "fldcw %0" : : "m" (fpword
) );
1082 if (!sse2_cw
) return 1;
1086 __asm__
__volatile__( "stmxcsr %0" : "=m" (fpword
) );
1088 /* Convert into mask constants */
1090 if (fpword
& 0x80) flags
|= MSVCRT__EM_INVALID
;
1091 if (fpword
& 0x100) flags
|= MSVCRT__EM_DENORMAL
;
1092 if (fpword
& 0x200) flags
|= MSVCRT__EM_ZERODIVIDE
;
1093 if (fpword
& 0x400) flags
|= MSVCRT__EM_OVERFLOW
;
1094 if (fpword
& 0x800) flags
|= MSVCRT__EM_UNDERFLOW
;
1095 if (fpword
& 0x1000) flags
|= MSVCRT__EM_INEXACT
;
1096 switch (fpword
& 0x6000)
1098 case 0x6000: flags
|= MSVCRT__RC_UP
|MSVCRT__RC_DOWN
; break;
1099 case 0x4000: flags
|= MSVCRT__RC_UP
; break;
1100 case 0x2000: flags
|= MSVCRT__RC_DOWN
; break;
1102 switch (fpword
& 0x8040)
1104 case 0x0040: flags
|= MSVCRT__DN_FLUSH_OPERANDS_SAVE_RESULTS
; break;
1105 case 0x8000: flags
|= MSVCRT__DN_SAVE_OPERANDS_FLUSH_RESULTS
; break;
1106 case 0x8040: flags
|= MSVCRT__DN_FLUSH
; break;
1109 TRACE( "sse2 flags=%08x newval=%08x mask=%08x\n", flags
, newval
, mask
);
1112 flags
= (flags
& ~mask
) | (newval
& mask
);
1114 /* Convert (masked) value back to fp word */
1116 if (flags
& MSVCRT__EM_INVALID
) fpword
|= 0x80;
1117 if (flags
& MSVCRT__EM_DENORMAL
) fpword
|= 0x100;
1118 if (flags
& MSVCRT__EM_ZERODIVIDE
) fpword
|= 0x200;
1119 if (flags
& MSVCRT__EM_OVERFLOW
) fpword
|= 0x400;
1120 if (flags
& MSVCRT__EM_UNDERFLOW
) fpword
|= 0x800;
1121 if (flags
& MSVCRT__EM_INEXACT
) fpword
|= 0x1000;
1122 switch (flags
& MSVCRT__MCW_RC
)
1124 case MSVCRT__RC_UP
|MSVCRT__RC_DOWN
: fpword
|= 0x6000; break;
1125 case MSVCRT__RC_UP
: fpword
|= 0x4000; break;
1126 case MSVCRT__RC_DOWN
: fpword
|= 0x2000; break;
1128 switch (flags
& MSVCRT__MCW_DN
)
1130 case MSVCRT__DN_FLUSH_OPERANDS_SAVE_RESULTS
: fpword
|= 0x0040; break;
1131 case MSVCRT__DN_SAVE_OPERANDS_FLUSH_RESULTS
: fpword
|= 0x8000; break;
1132 case MSVCRT__DN_FLUSH
: fpword
|= 0x8040; break;
1134 __asm__
__volatile__( "ldmxcsr %0" : : "m" (fpword
) );
1142 FIXME( "not implemented\n" );
1148 /*********************************************************************
1149 * _control87 (MSVCRT.@)
1151 unsigned int CDECL
_control87(unsigned int newval
, unsigned int mask
)
1153 #if defined(__i386__) || defined(__x86_64__)
1154 unsigned int x86_cw
, sse2_cw
;
1156 __control87_2( newval
, mask
, &x86_cw
, &sse2_cw
);
1158 if ((x86_cw
^ sse2_cw
) & (MSVCRT__MCW_EM
| MSVCRT__MCW_RC
)) x86_cw
|= MSVCRT__EM_AMBIGUOUS
;
1161 FIXME( "not implemented\n" );
1166 /*********************************************************************
1167 * _controlfp (MSVCRT.@)
1169 unsigned int CDECL
_controlfp(unsigned int newval
, unsigned int mask
)
1171 return _control87( newval
, mask
& ~MSVCRT__EM_DENORMAL
);
1174 /*********************************************************************
1175 * _set_controlfp (MSVCRT.@)
1177 void CDECL
_set_controlfp( unsigned int newval
, unsigned int mask
)
1179 _controlfp( newval
, mask
);
1182 /*********************************************************************
1183 * _controlfp_s (MSVCRT.@)
1185 int CDECL
_controlfp_s(unsigned int *cur
, unsigned int newval
, unsigned int mask
)
1187 static const unsigned int all_flags
= (MSVCRT__MCW_EM
| MSVCRT__MCW_IC
| MSVCRT__MCW_RC
|
1188 MSVCRT__MCW_PC
| MSVCRT__MCW_DN
);
1191 if (!MSVCRT_CHECK_PMT( !(newval
& mask
& ~all_flags
) ))
1193 if (cur
) *cur
= _controlfp( 0, 0 ); /* retrieve it anyway */
1194 return MSVCRT_EINVAL
;
1196 val
= _controlfp( newval
, mask
);
1197 if (cur
) *cur
= val
;
1201 /*********************************************************************
1202 * fegetenv (MSVCR120.@)
1204 int CDECL
MSVCRT_fegetenv(MSVCRT_fenv_t
*env
)
1206 env
->control
= _controlfp(0, 0) & (MSVCRT__EM_INEXACT
| MSVCRT__EM_UNDERFLOW
|
1207 MSVCRT__EM_OVERFLOW
| MSVCRT__EM_ZERODIVIDE
| MSVCRT__EM_INVALID
);
1208 env
->status
= _statusfp();
1212 /*********************************************************************
1213 * __fpe_flt_rounds (UCRTBASE.@)
1215 int CDECL
__fpe_flt_rounds(void)
1217 unsigned int fpc
= _controlfp(0, 0) & MSVCRT__RC_CHOP
;
1222 case MSVCRT__RC_CHOP
: return 0;
1223 case MSVCRT__RC_NEAR
: return 1;
1225 case MSVCRT__RC_UP
: return 3;
1228 case MSVCRT__RC_UP
: return 2;
1234 /*********************************************************************
1235 * _copysign (MSVCRT.@)
1237 double CDECL
MSVCRT__copysign(double num
, double sign
)
1240 return signbit(num
) ? num
: -num
;
1241 return signbit(num
) ? -num
: num
;
1244 /*********************************************************************
1245 * _finite (MSVCRT.@)
1247 int CDECL
MSVCRT__finite(double num
)
1249 return isfinite(num
) != 0; /* See comment for _isnan() */
1252 /*********************************************************************
1253 * _fpreset (MSVCRT.@)
1255 void CDECL
_fpreset(void)
1257 #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
1258 const unsigned int x86_cw
= 0x27f;
1259 __asm__
__volatile__( "fninit; fldcw %0" : : "m" (x86_cw
) );
1262 const unsigned long sse2_cw
= 0x1f80;
1263 __asm__
__volatile__( "ldmxcsr %0" : : "m" (sse2_cw
) );
1266 FIXME( "not implemented\n" );
1270 /*********************************************************************
1273 INT CDECL
MSVCRT__isnan(double num
)
1275 /* Some implementations return -1 for true(glibc), msvcrt/crtdll return 1.
1276 * Do the same, as the result may be used in calculations
1278 return isnan(num
) != 0;
1281 /*********************************************************************
1284 double CDECL
MSVCRT__j0(double num
)
1286 /* FIXME: errno handling */
1290 /*********************************************************************
1293 double CDECL
MSVCRT__j1(double num
)
1295 /* FIXME: errno handling */
1299 /*********************************************************************
1302 double CDECL
MSVCRT__jn(int n
, double num
)
1304 /* FIXME: errno handling */
1308 /*********************************************************************
1311 double CDECL
MSVCRT__y0(double num
)
1314 if (!isfinite(num
)) *MSVCRT__errno() = MSVCRT_EDOM
;
1316 if (MSVCRT__fpclass(retval
) == MSVCRT__FPCLASS_NINF
)
1318 *MSVCRT__errno() = MSVCRT_EDOM
;
1324 /*********************************************************************
1327 double CDECL
MSVCRT__y1(double num
)
1330 if (!isfinite(num
)) *MSVCRT__errno() = MSVCRT_EDOM
;
1332 if (MSVCRT__fpclass(retval
) == MSVCRT__FPCLASS_NINF
)
1334 *MSVCRT__errno() = MSVCRT_EDOM
;
1340 /*********************************************************************
1343 double CDECL
MSVCRT__yn(int order
, double num
)
1346 if (!isfinite(num
)) *MSVCRT__errno() = MSVCRT_EDOM
;
1347 retval
= yn(order
,num
);
1348 if (MSVCRT__fpclass(retval
) == MSVCRT__FPCLASS_NINF
)
1350 *MSVCRT__errno() = MSVCRT_EDOM
;
1356 /*********************************************************************
1357 * _nextafter (MSVCRT.@)
1359 double CDECL
MSVCRT__nextafter(double num
, double next
)
1362 if (!isfinite(num
) || !isfinite(next
)) *MSVCRT__errno() = MSVCRT_EDOM
;
1363 retval
= nextafter(num
,next
);
1367 /*********************************************************************
1370 char * CDECL
MSVCRT__ecvt( double number
, int ndigits
, int *decpt
, int *sign
)
1373 thread_data_t
*data
= msvcrt_get_thread_data();
1374 /* FIXME: check better for overflow (native supports over 300 chars) */
1375 ndigits
= min( ndigits
, 80 - 7); /* 7 : space for dec point, 1 for "e",
1376 * 4 for exponent and one for
1377 * terminating '\0' */
1378 if (!data
->efcvt_buffer
)
1379 data
->efcvt_buffer
= MSVCRT_malloc( 80 ); /* ought to be enough */
1386 /* handle cases with zero ndigits or less */
1388 if( prec
< 1) prec
= 2;
1389 len
= snprintf(data
->efcvt_buffer
, 80, "%.*le", prec
- 1, number
);
1390 /* take the decimal "point away */
1392 memmove( data
->efcvt_buffer
+ 1, data
->efcvt_buffer
+ 2, len
- 1 );
1393 /* take the exponential "e" out */
1394 data
->efcvt_buffer
[ prec
] = '\0';
1395 /* read the exponent */
1396 sscanf( data
->efcvt_buffer
+ prec
+ 1, "%d", decpt
);
1398 /* adjust for some border cases */
1399 if( data
->efcvt_buffer
[0] == '0')/* value is zero */
1401 /* handle cases with zero ndigits or less */
1403 if( data
->efcvt_buffer
[ 0] >= '5')
1405 data
->efcvt_buffer
[ 0] = '\0';
1407 TRACE("out=\"%s\"\n",data
->efcvt_buffer
);
1408 return data
->efcvt_buffer
;
1411 /*********************************************************************
1412 * _ecvt_s (MSVCRT.@)
1414 int CDECL
MSVCRT__ecvt_s( char *buffer
, MSVCRT_size_t length
, double number
, int ndigits
, int *decpt
, int *sign
)
1418 const char infret
[] = "1#INF";
1420 if (!MSVCRT_CHECK_PMT(buffer
!= NULL
)) return MSVCRT_EINVAL
;
1421 if (!MSVCRT_CHECK_PMT(decpt
!= NULL
)) return MSVCRT_EINVAL
;
1422 if (!MSVCRT_CHECK_PMT(sign
!= NULL
)) return MSVCRT_EINVAL
;
1423 if (!MSVCRT_CHECK_PMT_ERR( length
> 2, MSVCRT_ERANGE
)) return MSVCRT_ERANGE
;
1424 if (!MSVCRT_CHECK_PMT_ERR(ndigits
< (int)length
- 1, MSVCRT_ERANGE
)) return MSVCRT_ERANGE
;
1426 /* special case - inf */
1427 if(number
== HUGE_VAL
|| number
== -HUGE_VAL
)
1429 memset(buffer
, '0', ndigits
);
1430 memcpy(buffer
, infret
, min(ndigits
, sizeof(infret
) - 1 ) );
1431 buffer
[ndigits
] = '\0';
1433 if(number
== -HUGE_VAL
)
1439 /* handle cases with zero ndigits or less */
1441 if( prec
< 1) prec
= 2;
1442 result
= MSVCRT_malloc(prec
+ 7);
1449 len
= snprintf(result
, prec
+ 7, "%.*le", prec
- 1, number
);
1450 /* take the decimal "point away */
1452 memmove( result
+ 1, result
+ 2, len
- 1 );
1453 /* take the exponential "e" out */
1454 result
[ prec
] = '\0';
1455 /* read the exponent */
1456 sscanf( result
+ prec
+ 1, "%d", decpt
);
1458 /* adjust for some border cases */
1459 if( result
[0] == '0')/* value is zero */
1461 /* handle cases with zero ndigits or less */
1463 if( result
[ 0] >= '5')
1467 memcpy( buffer
, result
, max(ndigits
+ 1, 1) );
1468 MSVCRT_free( result
);
1472 /***********************************************************************
1475 char * CDECL
MSVCRT__fcvt( double number
, int ndigits
, int *decpt
, int *sign
)
1477 thread_data_t
*data
= msvcrt_get_thread_data();
1478 int stop
, dec1
, dec2
;
1479 char *ptr1
, *ptr2
, *first
;
1480 char buf
[80]; /* ought to be enough */
1482 if (!data
->efcvt_buffer
)
1483 data
->efcvt_buffer
= MSVCRT_malloc( 80 ); /* ought to be enough */
1491 snprintf(buf
, 80, "%.*f", ndigits
< 0 ? 0 : ndigits
, number
);
1493 ptr2
= data
->efcvt_buffer
;
1498 /* For numbers below the requested resolution, work out where
1499 the decimal point will be rather than finding it in the string */
1500 if (number
< 1.0 && number
> 0.0) {
1501 dec2
= log10(number
+ 1e-10);
1502 if (-dec2
<= ndigits
) dec2
= 0;
1505 /* If requested digits is zero or less, we will need to truncate
1506 * the returned string */
1508 stop
= strlen(buf
) + ndigits
;
1513 while (*ptr1
== '0') ptr1
++; /* Skip leading zeroes */
1514 while (*ptr1
!= '\0' && *ptr1
!= '.') {
1515 if (!first
) first
= ptr2
;
1516 if ((ptr1
- buf
) < stop
) {
1527 while (*ptr1
== '0') { /* Process leading zeroes */
1532 while (*ptr1
!= '\0') {
1533 if (!first
) first
= ptr2
;
1540 /* We never found a non-zero digit, then our number is either
1541 * smaller than the requested precision, or 0.0 */
1546 first
= data
->efcvt_buffer
;
1551 *decpt
= dec2
? dec2
: dec1
;
1555 /***********************************************************************
1556 * _fcvt_s (MSVCRT.@)
1558 int CDECL
MSVCRT__fcvt_s(char* outbuffer
, MSVCRT_size_t size
, double number
, int ndigits
, int *decpt
, int *sign
)
1560 int stop
, dec1
, dec2
;
1561 char *ptr1
, *ptr2
, *first
;
1562 char buf
[80]; /* ought to be enough */
1564 if (!outbuffer
|| !decpt
|| !sign
|| size
== 0)
1566 *MSVCRT__errno() = MSVCRT_EINVAL
;
1567 return MSVCRT_EINVAL
;
1576 snprintf(buf
, 80, "%.*f", ndigits
< 0 ? 0 : ndigits
, number
);
1583 /* For numbers below the requested resolution, work out where
1584 the decimal point will be rather than finding it in the string */
1585 if (number
< 1.0 && number
> 0.0) {
1586 dec2
= log10(number
+ 1e-10);
1587 if (-dec2
<= ndigits
) dec2
= 0;
1590 /* If requested digits is zero or less, we will need to truncate
1591 * the returned string */
1593 stop
= strlen(buf
) + ndigits
;
1598 while (*ptr1
== '0') ptr1
++; /* Skip leading zeroes */
1599 while (*ptr1
!= '\0' && *ptr1
!= '.') {
1600 if (!first
) first
= ptr2
;
1601 if ((ptr1
- buf
) < stop
) {
1615 while (*ptr1
== '0') { /* Process leading zeroes */
1616 if (number
== 0.0 && size
> 1) {
1624 while (*ptr1
!= '\0') {
1625 if (!first
) first
= ptr2
;
1635 /* We never found a non-zero digit, then our number is either
1636 * smaller than the requested precision, or 0.0 */
1637 if (!first
&& (number
<= 0.0))
1640 *decpt
= dec2
? dec2
: dec1
;
1644 /***********************************************************************
1647 char * CDECL
MSVCRT__gcvt( double number
, int ndigit
, char *buff
)
1650 *MSVCRT__errno() = MSVCRT_EINVAL
;
1655 *MSVCRT__errno() = MSVCRT_ERANGE
;
1659 MSVCRT_sprintf(buff
, "%.*g", ndigit
, number
);
1663 /***********************************************************************
1664 * _gcvt_s (MSVCRT.@)
1666 int CDECL
MSVCRT__gcvt_s(char *buff
, MSVCRT_size_t size
, double number
, int digits
)
1671 *MSVCRT__errno() = MSVCRT_EINVAL
;
1672 return MSVCRT_EINVAL
;
1675 if( digits
<0 || digits
>=size
) {
1679 *MSVCRT__errno() = MSVCRT_ERANGE
;
1680 return MSVCRT_ERANGE
;
1683 len
= MSVCRT__scprintf("%.*g", digits
, number
);
1686 *MSVCRT__errno() = MSVCRT_ERANGE
;
1687 return MSVCRT_ERANGE
;
1690 MSVCRT_sprintf(buff
, "%.*g", digits
, number
);
1694 #include <stdlib.h> /* div_t, ldiv_t */
1696 /*********************************************************************
1699 * [i386] Windows binary compatible - returns the struct in eax/edx.
1702 unsigned __int64 CDECL
MSVCRT_div(int num
, int denom
)
1704 div_t dt
= div(num
,denom
);
1705 return ((unsigned __int64
)dt
.rem
<< 32) | (unsigned int)dt
.quot
;
1708 /*********************************************************************
1711 * [!i386] Non-x86 can't run win32 apps so we don't need binary compatibility
1713 MSVCRT_div_t CDECL
MSVCRT_div(int num
, int denom
)
1715 div_t dt
= div(num
,denom
);
1723 #endif /* ifdef __i386__ */
1726 /*********************************************************************
1729 * [i386] Windows binary compatible - returns the struct in eax/edx.
1732 unsigned __int64 CDECL
MSVCRT_ldiv(MSVCRT_long num
, MSVCRT_long denom
)
1734 ldiv_t ldt
= ldiv(num
,denom
);
1735 return ((unsigned __int64
)ldt
.rem
<< 32) | (MSVCRT_ulong
)ldt
.quot
;
1738 /*********************************************************************
1741 * [!i386] Non-x86 can't run win32 apps so we don't need binary compatibility
1743 MSVCRT_ldiv_t CDECL
MSVCRT_ldiv(MSVCRT_long num
, MSVCRT_long denom
)
1745 ldiv_t result
= ldiv(num
,denom
);
1748 ret
.quot
= result
.quot
;
1749 ret
.rem
= result
.rem
;
1753 #endif /* ifdef __i386__ */
1757 /*********************************************************************
1758 * _adjust_fdiv (MSVCRT.@)
1759 * Used by the MSVC compiler to work around the Pentium FDIV bug.
1761 int MSVCRT__adjust_fdiv
= 0;
1763 /***********************************************************************
1764 * _adj_fdiv_m16i (MSVCRT.@)
1767 * I _think_ this function is intended to work around the Pentium
1770 void __stdcall
_adj_fdiv_m16i( short arg
)
1772 TRACE("(): stub\n");
1775 /***********************************************************************
1776 * _adj_fdiv_m32 (MSVCRT.@)
1779 * I _think_ this function is intended to work around the Pentium
1782 void __stdcall
_adj_fdiv_m32( unsigned int arg
)
1784 TRACE("(): stub\n");
1787 /***********************************************************************
1788 * _adj_fdiv_m32i (MSVCRT.@)
1791 * I _think_ this function is intended to work around the Pentium
1794 void __stdcall
_adj_fdiv_m32i( int arg
)
1796 TRACE("(): stub\n");
1799 /***********************************************************************
1800 * _adj_fdiv_m64 (MSVCRT.@)
1803 * I _think_ this function is intended to work around the Pentium
1806 void __stdcall
_adj_fdiv_m64( unsigned __int64 arg
)
1808 TRACE("(): stub\n");
1811 /***********************************************************************
1812 * _adj_fdiv_r (MSVCRT.@)
1814 * This function is likely to have the wrong number of arguments.
1817 * I _think_ this function is intended to work around the Pentium
1820 void _adj_fdiv_r(void)
1822 TRACE("(): stub\n");
1825 /***********************************************************************
1826 * _adj_fdivr_m16i (MSVCRT.@)
1829 * I _think_ this function is intended to work around the Pentium
1832 void __stdcall
_adj_fdivr_m16i( short arg
)
1834 TRACE("(): stub\n");
1837 /***********************************************************************
1838 * _adj_fdivr_m32 (MSVCRT.@)
1841 * I _think_ this function is intended to work around the Pentium
1844 void __stdcall
_adj_fdivr_m32( unsigned int arg
)
1846 TRACE("(): stub\n");
1849 /***********************************************************************
1850 * _adj_fdivr_m32i (MSVCRT.@)
1853 * I _think_ this function is intended to work around the Pentium
1856 void __stdcall
_adj_fdivr_m32i( int arg
)
1858 TRACE("(): stub\n");
1861 /***********************************************************************
1862 * _adj_fdivr_m64 (MSVCRT.@)
1865 * I _think_ this function is intended to work around the Pentium
1868 void __stdcall
_adj_fdivr_m64( unsigned __int64 arg
)
1870 TRACE("(): stub\n");
1873 /***********************************************************************
1874 * _adj_fpatan (MSVCRT.@)
1876 * This function is likely to have the wrong number of arguments.
1879 * I _think_ this function is intended to work around the Pentium
1882 void _adj_fpatan(void)
1884 TRACE("(): stub\n");
1887 /***********************************************************************
1888 * _adj_fprem (MSVCRT.@)
1890 * This function is likely to have the wrong number of arguments.
1893 * I _think_ this function is intended to work around the Pentium
1896 void _adj_fprem(void)
1898 TRACE("(): stub\n");
1901 /***********************************************************************
1902 * _adj_fprem1 (MSVCRT.@)
1904 * This function is likely to have the wrong number of arguments.
1907 * I _think_ this function is intended to work around the Pentium
1910 void _adj_fprem1(void)
1912 TRACE("(): stub\n");
1915 /***********************************************************************
1916 * _adj_fptan (MSVCRT.@)
1918 * This function is likely to have the wrong number of arguments.
1921 * I _think_ this function is intended to work around the Pentium
1924 void _adj_fptan(void)
1926 TRACE("(): stub\n");
1929 /***********************************************************************
1930 * _safe_fdiv (MSVCRT.@)
1932 * This function is likely to have the wrong number of arguments.
1935 * I _think_ this function is intended to work around the Pentium
1938 void _safe_fdiv(void)
1940 TRACE("(): stub\n");
1943 /***********************************************************************
1944 * _safe_fdivr (MSVCRT.@)
1946 * This function is likely to have the wrong number of arguments.
1949 * I _think_ this function is intended to work around the Pentium
1952 void _safe_fdivr(void)
1954 TRACE("(): stub\n");
1957 /***********************************************************************
1958 * _safe_fprem (MSVCRT.@)
1960 * This function is likely to have the wrong number of arguments.
1963 * I _think_ this function is intended to work around the Pentium
1966 void _safe_fprem(void)
1968 TRACE("(): stub\n");
1971 /***********************************************************************
1972 * _safe_fprem1 (MSVCRT.@)
1975 * This function is likely to have the wrong number of arguments.
1978 * I _think_ this function is intended to work around the Pentium
1981 void _safe_fprem1(void)
1983 TRACE("(): stub\n");
1986 /***********************************************************************
1987 * __libm_sse2_acos (MSVCRT.@)
1989 void __cdecl
MSVCRT___libm_sse2_acos(void)
1992 __asm__
__volatile__( "movq %%xmm0,%0" : "=m" (d
) );
1994 __asm__
__volatile__( "movq %0,%%xmm0" : : "m" (d
) );
1997 /***********************************************************************
1998 * __libm_sse2_acosf (MSVCRT.@)
2000 void __cdecl
MSVCRT___libm_sse2_acosf(void)
2003 __asm__
__volatile__( "movd %%xmm0,%0" : "=g" (f
) );
2005 __asm__
__volatile__( "movd %0,%%xmm0" : : "g" (f
) );
2008 /***********************************************************************
2009 * __libm_sse2_asin (MSVCRT.@)
2011 void __cdecl
MSVCRT___libm_sse2_asin(void)
2014 __asm__
__volatile__( "movq %%xmm0,%0" : "=m" (d
) );
2016 __asm__
__volatile__( "movq %0,%%xmm0" : : "m" (d
) );
2019 /***********************************************************************
2020 * __libm_sse2_asinf (MSVCRT.@)
2022 void __cdecl
MSVCRT___libm_sse2_asinf(void)
2025 __asm__
__volatile__( "movd %%xmm0,%0" : "=g" (f
) );
2027 __asm__
__volatile__( "movd %0,%%xmm0" : : "g" (f
) );
2030 /***********************************************************************
2031 * __libm_sse2_atan (MSVCRT.@)
2033 void __cdecl
MSVCRT___libm_sse2_atan(void)
2036 __asm__
__volatile__( "movq %%xmm0,%0" : "=m" (d
) );
2038 __asm__
__volatile__( "movq %0,%%xmm0" : : "m" (d
) );
2041 /***********************************************************************
2042 * __libm_sse2_atan2 (MSVCRT.@)
2044 void __cdecl
MSVCRT___libm_sse2_atan2(void)
2047 __asm__
__volatile__( "movq %%xmm0,%0; movq %%xmm1,%1 " : "=m" (d1
), "=m" (d2
) );
2048 d1
= atan2( d1
, d2
);
2049 __asm__
__volatile__( "movq %0,%%xmm0" : : "m" (d1
) );
2052 /***********************************************************************
2053 * __libm_sse2_atanf (MSVCRT.@)
2055 void __cdecl
MSVCRT___libm_sse2_atanf(void)
2058 __asm__
__volatile__( "movd %%xmm0,%0" : "=g" (f
) );
2060 __asm__
__volatile__( "movd %0,%%xmm0" : : "g" (f
) );
2063 /***********************************************************************
2064 * __libm_sse2_cos (MSVCRT.@)
2066 void __cdecl
MSVCRT___libm_sse2_cos(void)
2069 __asm__
__volatile__( "movq %%xmm0,%0" : "=m" (d
) );
2071 __asm__
__volatile__( "movq %0,%%xmm0" : : "m" (d
) );
2074 /***********************************************************************
2075 * __libm_sse2_cosf (MSVCRT.@)
2077 void __cdecl
MSVCRT___libm_sse2_cosf(void)
2080 __asm__
__volatile__( "movd %%xmm0,%0" : "=g" (f
) );
2082 __asm__
__volatile__( "movd %0,%%xmm0" : : "g" (f
) );
2085 /***********************************************************************
2086 * __libm_sse2_exp (MSVCRT.@)
2088 void __cdecl
MSVCRT___libm_sse2_exp(void)
2091 __asm__
__volatile__( "movq %%xmm0,%0" : "=m" (d
) );
2093 __asm__
__volatile__( "movq %0,%%xmm0" : : "m" (d
) );
2096 /***********************************************************************
2097 * __libm_sse2_expf (MSVCRT.@)
2099 void __cdecl
MSVCRT___libm_sse2_expf(void)
2102 __asm__
__volatile__( "movd %%xmm0,%0" : "=g" (f
) );
2104 __asm__
__volatile__( "movd %0,%%xmm0" : : "g" (f
) );
2107 /***********************************************************************
2108 * __libm_sse2_log (MSVCRT.@)
2110 void __cdecl
MSVCRT___libm_sse2_log(void)
2113 __asm__
__volatile__( "movq %%xmm0,%0" : "=m" (d
) );
2115 __asm__
__volatile__( "movq %0,%%xmm0" : : "m" (d
) );
2118 /***********************************************************************
2119 * __libm_sse2_log10 (MSVCRT.@)
2121 void __cdecl
MSVCRT___libm_sse2_log10(void)
2124 __asm__
__volatile__( "movq %%xmm0,%0" : "=m" (d
) );
2126 __asm__
__volatile__( "movq %0,%%xmm0" : : "m" (d
) );
2129 /***********************************************************************
2130 * __libm_sse2_log10f (MSVCRT.@)
2132 void __cdecl
MSVCRT___libm_sse2_log10f(void)
2135 __asm__
__volatile__( "movd %%xmm0,%0" : "=g" (f
) );
2137 __asm__
__volatile__( "movd %0,%%xmm0" : : "g" (f
) );
2140 /***********************************************************************
2141 * __libm_sse2_logf (MSVCRT.@)
2143 void __cdecl
MSVCRT___libm_sse2_logf(void)
2146 __asm__
__volatile__( "movd %%xmm0,%0" : "=g" (f
) );
2148 __asm__
__volatile__( "movd %0,%%xmm0" : : "g" (f
) );
2151 /***********************************************************************
2152 * __libm_sse2_pow (MSVCRT.@)
2154 void __cdecl
MSVCRT___libm_sse2_pow(void)
2157 __asm__
__volatile__( "movq %%xmm0,%0; movq %%xmm1,%1 " : "=m" (d1
), "=m" (d2
) );
2159 __asm__
__volatile__( "movq %0,%%xmm0" : : "m" (d1
) );
2162 /***********************************************************************
2163 * __libm_sse2_powf (MSVCRT.@)
2165 void __cdecl
MSVCRT___libm_sse2_powf(void)
2168 __asm__
__volatile__( "movd %%xmm0,%0; movd %%xmm1,%1" : "=g" (f1
), "=g" (f2
) );
2169 f1
= powf( f1
, f2
);
2170 __asm__
__volatile__( "movd %0,%%xmm0" : : "g" (f1
) );
2173 /***********************************************************************
2174 * __libm_sse2_sin (MSVCRT.@)
2176 void __cdecl
MSVCRT___libm_sse2_sin(void)
2179 __asm__
__volatile__( "movq %%xmm0,%0" : "=m" (d
) );
2181 __asm__
__volatile__( "movq %0,%%xmm0" : : "m" (d
) );
2184 /***********************************************************************
2185 * __libm_sse2_sinf (MSVCRT.@)
2187 void __cdecl
MSVCRT___libm_sse2_sinf(void)
2190 __asm__
__volatile__( "movd %%xmm0,%0" : "=g" (f
) );
2192 __asm__
__volatile__( "movd %0,%%xmm0" : : "g" (f
) );
2195 /***********************************************************************
2196 * __libm_sse2_tan (MSVCRT.@)
2198 void __cdecl
MSVCRT___libm_sse2_tan(void)
2201 __asm__
__volatile__( "movq %%xmm0,%0" : "=m" (d
) );
2203 __asm__
__volatile__( "movq %0,%%xmm0" : : "m" (d
) );
2206 /***********************************************************************
2207 * __libm_sse2_tanf (MSVCRT.@)
2209 void __cdecl
MSVCRT___libm_sse2_tanf(void)
2212 __asm__
__volatile__( "movd %%xmm0,%0" : "=g" (f
) );
2214 __asm__
__volatile__( "movd %0,%%xmm0" : : "g" (f
) );
2217 /***********************************************************************
2218 * __libm_sse2_sqrt_precise (MSVCR110.@)
2220 void __cdecl
MSVCRT___libm_sse2_sqrt_precise(void)
2223 __asm__
__volatile__( "movq %%xmm0,%0" : "=m" (d
) );
2225 __asm__
__volatile__( "movq %0,%%xmm0" : : "m" (d
) );
2228 #endif /* __i386__ */
2230 /*********************************************************************
2233 double CDECL
MSVCR120_cbrt(double x
)
2238 return x
< 0 ? -pow(-x
, 1.0 / 3.0) : pow(x
, 1.0 / 3.0);
2242 /*********************************************************************
2243 * cbrtf (MSVCR120.@)
2245 float CDECL
MSVCR120_cbrtf(float x
)
2250 return MSVCR120_cbrt(x
);
2254 /*********************************************************************
2255 * cbrtl (MSVCR120.@)
2257 LDOUBLE CDECL
MSVCR120_cbrtl(LDOUBLE x
)
2259 return MSVCR120_cbrt(x
);
2262 /*********************************************************************
2265 double CDECL
MSVCR120_exp2(double x
)
2274 /*********************************************************************
2275 * exp2f (MSVCR120.@)
2277 float CDECL
MSVCR120_exp2f(float x
)
2282 return MSVCR120_exp2(x
);
2286 /*********************************************************************
2287 * exp2l (MSVCR120.@)
2289 LDOUBLE CDECL
MSVCR120_exp2l(LDOUBLE x
)
2291 return MSVCR120_exp2(x
);
2294 /*********************************************************************
2297 double CDECL
MSVCR120_log2(double x
)
2302 return log(x
) / log(2);
2306 /*********************************************************************
2307 * log2f (MSVCR120.@)
2309 float CDECL
MSVCR120_log2f(float x
)
2314 return MSVCR120_log2(x
);
2318 /*********************************************************************
2319 * log2l (MSVCR120.@)
2321 LDOUBLE CDECL
MSVCR120_log2l(LDOUBLE x
)
2323 return MSVCR120_log2(x
);
2326 /*********************************************************************
2329 double CDECL
MSVCR120_rint(double x
)
2334 return x
>= 0 ? floor(x
+ 0.5) : ceil(x
- 0.5);
2338 /*********************************************************************
2339 * rintf (MSVCR120.@)
2341 float CDECL
MSVCR120_rintf(float x
)
2346 return MSVCR120_rint(x
);
2350 /*********************************************************************
2351 * rintl (MSVCR120.@)
2353 LDOUBLE CDECL
MSVCR120_rintl(LDOUBLE x
)
2355 return MSVCR120_rint(x
);
2358 /*********************************************************************
2359 * lrint (MSVCR120.@)
2361 MSVCRT_long CDECL
MSVCR120_lrint(double x
)
2366 return MSVCR120_rint(x
);
2370 /*********************************************************************
2371 * lrintf (MSVCR120.@)
2373 MSVCRT_long CDECL
MSVCR120_lrintf(float x
)
2378 return MSVCR120_lrint(x
);
2382 /*********************************************************************
2383 * lrintl (MSVCR120.@)
2385 MSVCRT_long CDECL
MSVCR120_lrintl(LDOUBLE x
)
2387 return MSVCR120_lrint(x
);
2390 /*********************************************************************
2391 * llrint (MSVCR120.@)
2393 MSVCRT_longlong CDECL
MSVCR120_llrint(double x
)
2398 return MSVCR120_rint(x
);
2402 /*********************************************************************
2403 * llrintf (MSVCR120.@)
2405 MSVCRT_longlong CDECL
MSVCR120_llrintf(float x
)
2410 return MSVCR120_llrint(x
);
2414 /*********************************************************************
2415 * rintl (MSVCR120.@)
2417 MSVCRT_longlong CDECL
MSVCR120_llrintl(LDOUBLE x
)
2419 return MSVCR120_llrint(x
);
2422 /*********************************************************************
2423 * round (MSVCR120.@)
2425 double CDECL
MSVCR120_round(double x
)
2430 return MSVCR120_rint(x
);
2434 /*********************************************************************
2435 * roundf (MSVCR120.@)
2437 float CDECL
MSVCR120_roundf(float x
)
2442 return MSVCR120_round(x
);
2446 /*********************************************************************
2447 * roundl (MSVCR120.@)
2449 LDOUBLE CDECL
MSVCR120_roundl(LDOUBLE x
)
2451 return MSVCR120_round(x
);
2454 /*********************************************************************
2455 * lround (MSVCR120.@)
2457 MSVCRT_long CDECL
MSVCR120_lround(double x
)
2462 return MSVCR120_round(x
);
2466 /*********************************************************************
2467 * lroundf (MSVCR120.@)
2469 MSVCRT_long CDECL
MSVCR120_lroundf(float x
)
2474 return MSVCR120_lround(x
);
2478 /*********************************************************************
2479 * lroundl (MSVCR120.@)
2481 MSVCRT_long CDECL
MSVCR120_lroundl(LDOUBLE x
)
2483 return MSVCR120_lround(x
);
2486 /*********************************************************************
2487 * llround (MSVCR120.@)
2489 MSVCRT_longlong CDECL
MSVCR120_llround(double x
)
2494 return MSVCR120_round(x
);
2498 /*********************************************************************
2499 * llroundf (MSVCR120.@)
2501 MSVCRT_longlong CDECL
MSVCR120_llroundf(float x
)
2503 #ifdef HAVE_LLROUNDF
2506 return MSVCR120_llround(x
);
2510 /*********************************************************************
2511 * roundl (MSVCR120.@)
2513 MSVCRT_longlong CDECL
MSVCR120_llroundl(LDOUBLE x
)
2515 return MSVCR120_llround(x
);
2518 /*********************************************************************
2519 * trunc (MSVCR120.@)
2521 double CDECL
MSVCR120_trunc(double x
)
2526 return (x
> 0) ? floor(x
) : ceil(x
);
2530 /*********************************************************************
2531 * truncf (MSVCR120.@)
2533 float CDECL
MSVCR120_truncf(float x
)
2538 return MSVCR120_trunc(x
);
2542 /*********************************************************************
2543 * truncl (MSVCR120.@)
2545 LDOUBLE CDECL
MSVCR120_truncl(LDOUBLE x
)
2547 return MSVCR120_trunc(x
);
2550 /*********************************************************************
2551 * _dclass (MSVCR120.@)
2553 short CDECL
MSVCR120__dclass(double x
)
2555 switch (MSVCRT__fpclass(x
)) {
2556 case MSVCRT__FPCLASS_QNAN
:
2557 case MSVCRT__FPCLASS_SNAN
:
2558 return MSVCRT_FP_NAN
;
2559 case MSVCRT__FPCLASS_NINF
:
2560 case MSVCRT__FPCLASS_PINF
:
2561 return MSVCRT_FP_INFINITE
;
2562 case MSVCRT__FPCLASS_ND
:
2563 case MSVCRT__FPCLASS_PD
:
2564 return MSVCRT_FP_SUBNORMAL
;
2565 case MSVCRT__FPCLASS_NN
:
2566 case MSVCRT__FPCLASS_PN
:
2568 return MSVCRT_FP_NORMAL
;
2569 case MSVCRT__FPCLASS_NZ
:
2570 case MSVCRT__FPCLASS_PZ
:
2571 return MSVCRT_FP_ZERO
;
2575 /*********************************************************************
2576 * _fdclass (MSVCR120.@)
2578 short CDECL
MSVCR120__fdclass(float x
)
2580 return MSVCR120__dclass(x
);
2583 /*********************************************************************
2584 * _ldclass (MSVCR120.@)
2586 short CDECL
MSVCR120__ldclass(LDOUBLE x
)
2588 return MSVCR120__dclass(x
);
2591 /*********************************************************************
2592 * _dtest (MSVCR120.@)
2594 short CDECL
MSVCR120__dtest(double *x
)
2596 return MSVCR120__dclass(*x
);
2599 /*********************************************************************
2600 * _fdtest (MSVCR120.@)
2602 short CDECL
MSVCR120__fdtest(float *x
)
2604 return MSVCR120__dclass(*x
);
2607 /*********************************************************************
2608 * _ldtest (MSVCR120.@)
2610 short CDECL
MSVCR120__ldtest(LDOUBLE
*x
)
2612 return MSVCR120__dclass(*x
);
2615 /*********************************************************************
2618 float CDECL
MSVCR120_erff(float x
)
2623 FIXME( "not implemented\n" );
2628 /*********************************************************************
2631 double CDECL
MSVCR120_erf(double x
)
2636 FIXME( "not implemented\n" );
2641 /*********************************************************************
2644 LDOUBLE CDECL
MSVCR120_erfl(LDOUBLE x
)
2646 return MSVCR120_erf(x
);
2649 /*********************************************************************
2650 * fmaxf (MSVCR120.@)
2652 float CDECL
MSVCR120_fmaxf(float x
, float y
)
2659 return signbit(x
) ? y
: x
;
2663 /*********************************************************************
2666 double CDECL
MSVCR120_fmax(double x
, double y
)
2673 return signbit(x
) ? y
: x
;
2677 /*********************************************************************
2678 * _fdsign (MSVCR120.@)
2680 int CDECL
MSVCR120__fdsign(float x
)
2682 return signbit(x
) ? 0x8000 : 0;
2685 /*********************************************************************
2686 * _dsign (MSVCR120.@)
2688 int CDECL
MSVCR120__dsign(double x
)
2690 return signbit(x
) ? 0x8000 : 0;
2694 /*********************************************************************
2695 * _dpcomp (MSVCR120.@)
2697 int CDECL
MSVCR120__dpcomp(double x
, double y
)
2699 if(isnan(x
) || isnan(y
))
2702 if(x
== y
) return 2;
2703 return x
< y
? 1 : 4;
2706 /*********************************************************************
2707 * _fdpcomp (MSVCR120.@)
2709 int CDECL
MSVCR120__fdpcomp(float x
, float y
)
2711 return MSVCR120__dpcomp(x
, y
);
2714 /*********************************************************************
2715 * fminf (MSVCR120.@)
2717 float CDECL
MSVCR120_fminf(float x
, float y
)
2724 return signbit(x
) ? x
: y
;
2728 /*********************************************************************
2731 double CDECL
MSVCR120_fmin(double x
, double y
)
2738 return signbit(x
) ? x
: y
;
2742 /*********************************************************************
2743 * asinh (MSVCR120.@)
2745 double CDECL
MSVCR120_asinh(double x
)
2750 FIXME( "not implemented\n" );
2755 /*********************************************************************
2756 * asinhf (MSVCR120.@)
2758 float CDECL
MSVCR120_asinhf(float x
)
2763 FIXME( "not implemented\n" );
2768 /*********************************************************************
2769 * asinhl (MSVCR120.@)
2771 LDOUBLE CDECL
MSVCR120_asinhl(LDOUBLE x
)
2773 return MSVCR120_asinh(x
);
2776 /*********************************************************************
2778 * scalbn (MSVCR120.@)
2779 * scalbln (MSVCR120.@)
2781 double CDECL
MSVCRT__scalb(double num
, MSVCRT_long power
)
2783 if (!isfinite(num
)) *MSVCRT__errno() = MSVCRT_EDOM
;
2784 return ldexp(num
, power
);
2787 /*********************************************************************
2788 * _scalbf (MSVCRT.@)
2789 * scalbnf (MSVCR120.@)
2790 * scalblnf (MSVCR120.@)
2792 float CDECL
MSVCRT__scalbf(float num
, MSVCRT_long power
)
2794 if (!finitef(num
)) *MSVCRT__errno() = MSVCRT_EDOM
;
2795 return ldexpf(num
, power
);
2798 /*********************************************************************
2799 * scalbnl (MSVCR120.@)
2800 * scalblnl (MSVCR120.@)
2802 LDOUBLE CDECL
MSVCR120_scalbnl(LDOUBLE num
, MSVCRT_long power
)
2804 return MSVCRT__scalb(num
, power
);
2807 /*********************************************************************
2808 * remainder (MSVCR120.@)
2810 double CDECL
MSVCR120_remainder(double x
, double y
)
2812 #ifdef HAVE_REMAINDER
2813 /* this matches 64-bit Windows. 32-bit Windows is slightly different */
2814 if(!finite(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
2815 if(isnan(y
) || y
==0.0) *MSVCRT__errno() = MSVCRT_EDOM
;
2816 return remainder(x
, y
);
2818 FIXME( "not implemented\n" );
2823 /*********************************************************************
2824 * remainderf (MSVCR120.@)
2826 float CDECL
MSVCR120_remainderf(float x
, float y
)
2828 #ifdef HAVE_REMAINDERF
2829 /* this matches 64-bit Windows. 32-bit Windows is slightly different */
2830 if(!finitef(x
)) *MSVCRT__errno() = MSVCRT_EDOM
;
2831 if(isnanf(y
) || y
==0.0f
) *MSVCRT__errno() = MSVCRT_EDOM
;
2832 return remainderf(x
, y
);
2834 FIXME( "not implemented\n" );
2839 /*********************************************************************
2840 * remainderl (MSVCR120.@)
2842 LDOUBLE CDECL
MSVCR120_remainderl(LDOUBLE x
, LDOUBLE y
)
2844 return MSVCR120_remainder(x
, y
);