Add incomplet long double math support to libmingwex.a

This commit is contained in:
Danny Smith
2002-07-29 03:00:10 +00:00
parent 840e611264
commit b8cdc234c6
143 changed files with 5213 additions and 639 deletions

View File

@ -0,0 +1,17 @@
#include <fenv.h>
#include <math.h>
double
trunc (double _x){
double retval;
unsigned short saved_cw;
__asm__ ("fnstcw %0;": "=m" (saved_cw)); /* save FPU control word */
__asm__ ("fldcw %0;"
:
: "m" ((saved_cw & ~(FE_TONEAREST | FE_DOWNWARD | FE_UPWARD
| FE_TOWARDZERO)) | FE_TOWARDZERO)
);
__asm__ ("frndint;" : "=t" (retval) : "0" (_x)); /* round towards zero */
__asm__ ("fldcw %0;" : : "m" (saved_cw) ); /* restore saved control word */
return retval;
}