- Add a number of amd64 specific math functions
- add generic c versions of cos and sin
- Remove leading underscores from amd64 symbols

svn path=/trunk/; revision=48161
This commit is contained in:
Timo Kreuzer 2010-07-21 16:03:44 +00:00
parent 6c98c1057f
commit f0daba18dd
30 changed files with 822 additions and 12 deletions

View file

@ -113,6 +113,7 @@
<file>adjust.c</file>
<file>asin.c</file>
<file>cabs.c</file>
<file>cosf.c</file>
<file>cosh.c</file>
<file>div.c</file>
<file>fdivbug.c</file>
@ -123,6 +124,7 @@
<file>modf.c</file>
<file>rand.c</file>
<file>s_modf.c</file>
<file>sinf.c</file>
<file>sinh.c</file>
<file>tanh.c</file>
<file>pow_asm.c</file>
@ -141,9 +143,11 @@
<file>aullrem_asm.s</file>
<file>aullshr_asm.s</file>
<file>ceil_asm.s</file>
<file>ceilf.S</file>
<file>cos_asm.s</file>
<file>fabs_asm.s</file>
<file>floor_asm.s</file>
<file>floorf.S</file>
<file>ftol_asm.s</file>
<file>log_asm.s</file>
<file>log10_asm.s</file>
@ -156,7 +160,9 @@
<file>ci.c</file>
<file>exp.c</file>
<file>fmod.c</file>
<file>fmodf.c</file>
<file>ldexp.c</file>
<file>sqrtf.c</file>
</directory>
<!-- FIXME: we don't actually implement these... they recursively call themselves through an alias -->
<!--<file>j0_y0.c</file>
@ -164,11 +170,27 @@
<file>jn_yn.c</file>-->
</if>
<if property="ARCH" value="amd64">
<directory name="i386">
<file>atan2.c</file>
<file>exp.c</file>
<file>fmod.c</file>
<file>ldexp.c</file>
<file>cos.c</file>
<file>sin.c</file>
<directory name="amd64">
<file>alldiv.S</file>
<file>atan.S</file>
<file>atan2.S</file>
<file>ceil.S</file>
<file>ceilf.S</file>
<file>exp.S</file>
<file>fabs.S</file>
<file>floor.S</file>
<file>floorf.S</file>
<file>fmod.S</file>
<file>fmodf.S</file>
<file>ldexp.S</file>
<file>log.S</file>
<file>log10.S</file>
<file>pow.S</file>
<file>sqrt.S</file>
<file>sqrtf.S</file>
<file>tan.S</file>
</directory>
<!-- FIXME: we don't actually implement these... they recursively call themselves through an alias -->
<!--<file>j0_y0.c</file>

View file

@ -8,24 +8,23 @@
/* INCLUDES ******************************************************************/
#include <ndk/amd64/asm.h>
#include <ndk/amd64/asmmacro.S>
#include <reactos/asm.h>
.intel_syntax noprefix
.global _MsgUnimplemented
_MsgUnimplemented:
.global MsgUnimplemented
MsgUnimplemented:
.asciz "WARNING: %s at %s:%d is UNIMPLEMENTED!\n"
.proc _chkstk
UNIMPLEMENTED chkstk
ret
.endproc
.endp
.proc _alloca_probe
UNIMPLEMENTED alloca_probe
ret
.endproc
.endp
/* EOF */

View file

@ -25,7 +25,7 @@
/* FUNCTIONS *****************************************************************/
.func unwind_handler
.func _unwind_handler
_unwind_handler:
ret
.endfunc

View file

@ -8,6 +8,7 @@
<define name="_NTDLLBUILD_" />
<define name="_LIBCNT_" />
<define name="_CRTBLD" />
<define name="__CRT__NO_INLINE" />
<if property="ARCH" value="i386">
<define name="__MINGW_IMPORT">"extern __attribute__ ((dllexport))"</define>
</if>
@ -59,6 +60,26 @@
<file>tan_asm.s</file>
</directory>
</if>
<if property="ARCH" value="amd64">
<file>cos.c</file>
<file>sin.c</file>
<directory name="amd64">
<file>alldiv.S</file>
<file>atan.S</file>
<file>atan2.S</file>
<file>ceil.S</file>
<file>exp.S</file>
<file>fabs.S</file>
<file>floor.S</file>
<file>fmod.S</file>
<file>ldexp.S</file>
<file>log.S</file>
<file>log10.S</file>
<file>pow.S</file>
<file>sqrt.S</file>
<file>tan.S</file>
</directory>
</if>
<file>abs.c</file>
<file>div.c</file>
<file>labs.c</file>

View file

@ -0,0 +1,28 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* PURPOSE: Implementation of alldiv
* FILE: lib/sdk/crt/math/amd64/alldiv.S
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h>
/* DATA *********************************************************************/
PUBLIC _fltused
_fltused:
.long 0x9875
/* FUNCTIONS ****************************************************************/
.code64
.proc alldiv
UNIMPLEMENTED alldiv
ret
.endp alldiv

View file

@ -0,0 +1,21 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* PURPOSE: Implementation of atan
* FILE: lib/sdk/crt/math/amd64/atan.S
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h>
/* FUNCTIONS ****************************************************************/
.code64
PUBLIC atan
atan:
UNIMPLEMENTED atan
ret

View file

@ -0,0 +1,21 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* PURPOSE: Implementation of atan2
* FILE: lib/sdk/crt/math/amd64/atan2.S
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h>
/* FUNCTIONS ****************************************************************/
.code64
PUBLIC atan2
atan2:
UNIMPLEMENTED atan2
ret

View file

@ -0,0 +1,22 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* PURPOSE: Implementation of ceil
* FILE: lib/sdk/crt/math/amd64/ceil.S
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h>
/* FUNCTIONS ****************************************************************/
.code64
PUBLIC ceil
ceil:
UNIMPLEMENTED ceil
ret

View file

@ -0,0 +1,40 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* PURPOSE: Implementation of tan
* FILE: lib/sdk/crt/math/amd64/ceilf.S
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h>
/* FUNCTIONS ****************************************************************/
.code64
PUBLIC ceilf
ceilf:
/* Put parameter on the stack */
movss [rsp - 0x10], xmm0
fld dword ptr [rsp]
/* Change fpu control word to round up */
fstcw [rsp - 0x10]
mov eax, [rsp - 0x10]
or eax, 0x00800
and eax, 0x0fbff
mov [rsp - 0x08], eax
fldcw [rsp - 0x08]
/* Round to integer */
frndint
/* Restore fpu control word */
fldcw [rsp - 0x10]
fstp dword ptr [rsp - 0x10]
movss xmm0, [rsp - 0x10]
ret

View file

@ -0,0 +1,22 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* PURPOSE: Implementation of exp
* FILE: lib/sdk/crt/math/amd64/exp.S
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h>
/* FUNCTIONS ****************************************************************/
.code64
PUBLIC exp
exp:
UNIMPLEMENTED exp
ret

View file

@ -0,0 +1,22 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* PURPOSE: Implementation of fabs
* FILE: lib/sdk/crt/math/amd64/fabs.S
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h>
/* FUNCTIONS ****************************************************************/
.code64
PUBLIC fabs
fabs:
UNIMPLEMENTED fabs
ret

View file

@ -0,0 +1,21 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* PURPOSE: Implementation of floor
* FILE: lib/sdk/crt/math/amd64/floor.S
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h>
/* FUNCTIONS ****************************************************************/
.code64
PUBLIC floor
floor:
UNIMPLEMENTED floor
ret

View file

@ -0,0 +1,40 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* PURPOSE: Implementation of tan
* FILE: lib/sdk/crt/math/amd64/floorf.S
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h>
/* FUNCTIONS ****************************************************************/
.code64
PUBLIC floorf
floorf:
/* Put parameter on the stack */
movss [rsp - 0x10], xmm0
fld dword ptr [rsp]
/* Change fpu control word to round down */
fstcw [rsp - 0x10]
mov eax, [rsp - 0x10]
or eax, 0x00400
and eax, 0x0f7ff
mov [rsp - 0x08], eax
fldcw [rsp - 0x08]
/* Round to integer */
frndint
/* Restore fpu control word */
fldcw [rsp - 0x10]
fstp dword ptr [rsp - 0x10]
movss xmm0, [rsp - 0x10]
ret

View file

@ -0,0 +1,19 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* PURPOSE: Implementation of fmod
* FILE: lib/sdk/crt/math/amd64/fmod.S
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h>
/* DATA *********************************************************************/
PUBLIC fmod
fmod:
UNIMPLEMENTED fmod
ret

View file

@ -0,0 +1,19 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* PURPOSE: Implementation of fmodf
* FILE: lib/sdk/crt/math/amd64/fmodf.S
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h>
/* DATA *********************************************************************/
PUBLIC fmodf
fmodf:
UNIMPLEMENTED fmodf
ret

View file

@ -0,0 +1,19 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* PURPOSE: Implementation of ldexp
* FILE: lib/sdk/crt/math/amd64/ldexp.S
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h>
/* DATA *********************************************************************/
PUBLIC ldexp
ldexp:
UNIMPLEMENTED ldexp
ret

View file

@ -0,0 +1,19 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* PURPOSE: Implementation of log
* FILE: lib/sdk/crt/math/amd64/log.S
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h>
/* DATA *********************************************************************/
PUBLIC log
log:
UNIMPLEMENTED log
ret

View file

@ -0,0 +1,20 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* PURPOSE: Implementation of log10
* FILE: lib/sdk/crt/math/amd64/log10.S
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h>
/* DATA *********************************************************************/
PUBLIC log10
log10:
UNIMPLEMENTED log10
ret

View file

@ -0,0 +1,20 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* PURPOSE: Implementation of pow
* FILE: lib/sdk/crt/math/amd64/pow.S
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h>
/* DATA *********************************************************************/
PUBLIC pow
pow:
UNIMPLEMENTED pow
ret

View file

@ -0,0 +1,19 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* PURPOSE: Implementation of sqrt
* FILE: lib/sdk/crt/math/amd64/sqrt.S
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h>
/* DATA *********************************************************************/
PUBLIC sqrt
sqrt:
UNIMPLEMENTED sqrt
ret

View file

@ -0,0 +1,19 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* PURPOSE: Implementation of tan
* FILE: lib/sdk/crt/math/amd64/sqrtf.S
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h>
/* DATA *********************************************************************/
PUBLIC sqrtf
sqrtf:
sqrtss xmm0, xmm0
ret

View file

@ -0,0 +1,19 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* PURPOSE: Implementation of tan
* FILE: lib/sdk/crt/math/amd64/tan.S
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h>
/* DATA *********************************************************************/
PUBLIC tan
tan:
UNIMPLEMENTED tan
ret

View file

@ -0,0 +1,89 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS CRT
* FILE: lib/crt/math/cos.c
* PURPOSE: Generic C Implementation of cos
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
#define PRECISION 9
#define M_PI 3.141592653589793238462643
static double cos_off_tbl[] = {0.0, -M_PI/2., 0, -M_PI/2.};
static double cos_sign_tbl[] = {1,-1,-1,1};
double
cos(double x)
{
int quadrant;
double x2, result;
/* Calculate the quadrant */
quadrant = x * (2./M_PI);
/* Get offset inside quadrant */
x = x - quadrant * (M_PI/2.);
/* Normalize quadrant to [0..3] */
quadrant = quadrant & 0x3;
/* Fixup value for the generic function */
x += cos_off_tbl[quadrant];
/* Calculate the negative of the square of x */
x2 = - (x * x);
/* This is an unrolled taylor series using <PRECISION> iterations
* Example with 4 iterations:
* result = 1 - x^2/2! + x^4/4! - x^6/6! + x^8/8!
* To save multiplications and to keep the precision high, it's performed
* like this:
* result = 1 - x^2 * (1/2! - x^2 * (1/4! - x^2 * (1/6! - x^2 * (1/8!))))
*/
/* Start with 0, compiler will optimize this away */
result = 0;
#if (PRECISION >= 10)
result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18*19*20);
result *= x2;
#endif
#if (PRECISION >= 9)
result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18);
result *= x2;
#endif
#if (PRECISION >= 8)
result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16);
result *= x2;
#endif
#if (PRECISION >= 7)
result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14);
result *= x2;
#endif
#if (PRECISION >= 6)
result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12);
result *= x2;
#endif
#if (PRECISION >= 5)
result += 1./(1.*2*3*4*5*6*7*8*9*10);
result *= x2;
#endif
result += 1./(1.*2*3*4*5*6*7*8);
result *= x2;
result += 1./(1.*2*3*4*5*6);
result *= x2;
result += 1./(1.*2*3*4);
result *= x2;
result += 1./(1.*2);
result *= x2;
result += 1;
/* Apply correct sign */
result *= cos_sign_tbl[quadrant];
return result;
}

View file

@ -0,0 +1,11 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#include <math.h>
float cosf(float _X)
{
return ((float)cos((double)_X));
}

View file

@ -0,0 +1,55 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#include <_mingw_mac.h>
.file "ceilf.S"
.text
.align 4
.globl __MINGW_USYMBOL(ceilf)
.def __MINGW_USYMBOL(ceilf); .scl 2; .type 32; .endef
__MINGW_USYMBOL(ceilf):
#ifdef _WIN64
subq $24,%rsp
movss %xmm0,8(%rsp)
flds 8(%rsp)
fstcw 4(%rsp) /* store fpu control word */
movl $0x0800,%edx /* round towards +oo */
orl 4(%rsp),%edx
andl $0xfbff,%edx
movl %edx,(%rsp)
fldcw (%rsp) /* load modified control word */
frndint /* round */
fldcw 4(%rsp) /* restore original control word */
fstps 8(%rsp)
movss 8(%rsp),%xmm0
addq $24,%rsp
ret
#else
flds 4(%esp)
subl $8,%esp
fstcw 4(%esp) /* store fpu control word */
/* We use here %edx although only the low 1 bits are defined.
But none of the operations should care and they are faster
than the 16 bit operations. */
movl $0x0800,%edx /* round towards +oo */
orl 4(%esp),%edx
andl $0xfbff,%edx
movl %edx,(%esp)
fldcw (%esp) /* load modified control word */
frndint /* round */
fldcw 4(%esp) /* restore original control word */
addl $8,%esp
ret
#endif

View file

@ -0,0 +1,63 @@
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*
* Changes for long double by Ulrich Drepper <drepper@cygnus.com>
*
* Removed header file dependency for use in libmingwex.a by
* Danny Smith <dannysmith@users.sourceforge.net>
*/
#include <_mingw_mac.h>
.file "floorf.S"
.text
#ifdef _WIN64
.align 8
#else
.align 4
#endif
.globl __MINGW_USYMBOL(floorf)
.def __MINGW_USYMBOL(floorf); .scl 2; .type 32; .endef
__MINGW_USYMBOL(floorf):
#ifdef _WIN64
subq $24,%rsp
movss %xmm0,8(%rsp)
flds 8(%rsp)
fstcw 4(%rsp) /* store fpu control word */
movl $0x400,%edx /* round towards -oo */
orl 4(%rsp),%edx
andl $0xf7ff,%edx
movl %edx,(%rsp)
fldcw (%rsp) /* load modified control word */
frndint /* round */
fldcw 4(%rsp) /* restore original control word */
fstps 8(%rsp)
movss 8(%rsp),%xmm0
addq $24,%rsp
ret
#else
flds 4(%esp)
subl $8,%esp
fstcw 4(%esp) /* store fpu control word */
/* We use here %edx although only the low 1 bits are defined.
But none of the operations should care and they are faster
than the 16 bit operations. */
movl $0x400,%edx /* round towards -oo */
orl 4(%esp),%edx
andl $0xf7ff,%edx
movl %edx,(%esp)
fldcw (%esp) /* load modified control word */
frndint /* round */
fldcw 4(%esp) /* restore original control word */
addl $8,%esp
ret
#endif

View file

@ -0,0 +1,28 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*
* Adapted for float type by Danny Smith
* <dannysmith@users.sourceforge.net>.
*/
#include <math.h>
float
fmodf (float x, float y)
{
float res = 0.0F;
asm ("1:\tfprem\n\t"
"fstsw %%ax\n\t"
"sahf\n\t"
"jp 1b\n\t"
"fstp %%st(1)"
: "=t" (res) : "0" (x), "u" (y) : "ax", "st(1)");
return res;
}

View file

@ -0,0 +1,12 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#include <math.h>
float
sqrtf(float x)
{
return ((float)sqrt((double)x));
}

View file

@ -0,0 +1,89 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS CRT
* FILE: lib/crt/math/sin.c
* PURPOSE: Generic C Implementation of sin
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
#define PRECISION 9
#define M_PI 3.141592653589793238462643
static double sin_off_tbl[] = {0.0, -M_PI/2., 0, -M_PI/2.};
static double sin_sign_tbl[] = {1,-1,-1,1};
double
sin(double x)
{
int quadrant;
double x2, result;
/* Calculate the quadrant */
quadrant = x * (2./M_PI);
/* Get offset inside quadrant */
x = x - quadrant * (M_PI/2.);
/* Normalize quadrant to [0..3] */
quadrant = (quadrant - 1) & 0x3;
/* Fixup value for the generic function */
x += sin_off_tbl[quadrant];
/* Calculate the negative of the square of x */
x2 = - (x * x);
/* This is an unrolled taylor series using <PRECISION> iterations
* Example with 4 iterations:
* result = 1 - x^2/2! + x^4/4! - x^6/6! + x^8/8!
* To save multiplications and to keep the precision high, it's performed
* like this:
* result = 1 - x^2 * (1/2! - x^2 * (1/4! - x^2 * (1/6! - x^2 * (1/8!))))
*/
/* Start with 0, compiler will optimize this away */
result = 0;
#if (PRECISION >= 10)
result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18*19*20);
result *= x2;
#endif
#if (PRECISION >= 9)
result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18);
result *= x2;
#endif
#if (PRECISION >= 8)
result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16);
result *= x2;
#endif
#if (PRECISION >= 7)
result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14);
result *= x2;
#endif
#if (PRECISION >= 6)
result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12);
result *= x2;
#endif
#if (PRECISION >= 5)
result += 1./(1.*2*3*4*5*6*7*8*9*10);
result *= x2;
#endif
result += 1./(1.*2*3*4*5*6*7*8);
result *= x2;
result += 1./(1.*2*3*4*5*6);
result *= x2;
result += 1./(1.*2*3*4);
result *= x2;
result += 1./(1.*2);
result *= x2;
result += 1;
/* Apply correct sign */
result *= sin_sign_tbl[quadrant];
return result;
}

View file

@ -0,0 +1,11 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#include <math.h>
float sinf(float _X)
{
return ((float) sin ((double) _X));
}