Added SDL_sqrtf(), SDL_tan(), SDL_tanf()
authorSam Lantinga <slouken@libsdl.org>
Sat, 07 Jun 2014 18:20:01 -0700
changeset 88409b6ddcbdea65
parent 8839 5ba49d7a39a0
child 8841 b7f41b4a7929
Added SDL_sqrtf(), SDL_tan(), SDL_tanf()
configure
configure.in
include/SDL_config.h.cmake
include/SDL_config.h.in
include/SDL_config_android.h
include/SDL_config_iphoneos.h
include/SDL_config_macosx.h
include/SDL_config_pandora.h
include/SDL_config_psp.h
include/SDL_config_windows.h
include/SDL_config_winrt.h
include/SDL_config_wiz.h
include/SDL_stdinc.h
src/dynapi/SDL_dynapi_overrides.h
src/dynapi/SDL_dynapi_procs.h
src/libm/k_tan.c
src/libm/math_libm.h
src/libm/math_private.h
src/libm/s_tan.c
src/stdlib/SDL_stdlib.c
     1.1 --- a/configure	Sat Jun 07 17:31:50 2014 -0700
     1.2 +++ b/configure	Sat Jun 07 18:20:01 2014 -0700
     1.3 @@ -16639,7 +16639,7 @@
     1.4    LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"
     1.5  fi
     1.6  
     1.7 -    for ac_func in atan atan2 acos asin ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt
     1.8 +    for ac_func in atan atan2 acos asin ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt tan tanf
     1.9  do :
    1.10    as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
    1.11  ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
     2.1 --- a/configure.in	Sat Jun 07 17:31:50 2014 -0700
     2.2 +++ b/configure.in	Sat Jun 07 18:20:01 2014 -0700
     2.3 @@ -271,7 +271,7 @@
     2.4      AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname)
     2.5  
     2.6      AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
     2.7 -    AC_CHECK_FUNCS(atan atan2 acos asin ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt)
     2.8 +    AC_CHECK_FUNCS(atan atan2 acos asin ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt tan tanf)
     2.9  
    2.10      AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
    2.11      AC_CHECK_FUNCS(iconv)
     3.1 --- a/include/SDL_config.h.cmake	Sat Jun 07 17:31:50 2014 -0700
     3.2 +++ b/include/SDL_config.h.cmake	Sat Jun 07 18:20:01 2014 -0700
     3.3 @@ -145,6 +145,9 @@
     3.4  #cmakedefine HAVE_SIN 1
     3.5  #cmakedefine HAVE_SINF 1
     3.6  #cmakedefine HAVE_SQRT 1
     3.7 +#cmakedefine HAVE_SQRTF 1
     3.8 +#cmakedefine HAVE_TAN 1
     3.9 +#cmakedefine HAVE_TANF 1
    3.10  #cmakedefine HAVE_FSEEKO 1
    3.11  #cmakedefine HAVE_FSEEKO64 1
    3.12  #cmakedefine HAVE_SIGACTION 1
     4.1 --- a/include/SDL_config.h.in	Sat Jun 07 17:31:50 2014 -0700
     4.2 +++ b/include/SDL_config.h.in	Sat Jun 07 18:20:01 2014 -0700
     4.3 @@ -150,6 +150,9 @@
     4.4  #undef HAVE_SIN
     4.5  #undef HAVE_SINF
     4.6  #undef HAVE_SQRT
     4.7 +#undef HAVE_SQRTF
     4.8 +#undef HAVE_TAN
     4.9 +#undef HAVE_TANF
    4.10  #undef HAVE_FSEEKO
    4.11  #undef HAVE_FSEEKO64
    4.12  #undef HAVE_SIGACTION
     5.1 --- a/include/SDL_config_android.h	Sat Jun 07 17:31:50 2014 -0700
     5.2 +++ b/include/SDL_config_android.h	Sat Jun 07 18:20:01 2014 -0700
     5.3 @@ -100,6 +100,9 @@
     5.4  #define HAVE_SIN    1
     5.5  #define HAVE_SINF   1
     5.6  #define HAVE_SQRT   1
     5.7 +#define HAVE_SQRTF  1
     5.8 +#define HAVE_TAN    1
     5.9 +#define HAVE_TANF   1
    5.10  #define HAVE_SIGACTION  1
    5.11  #define HAVE_SETJMP 1
    5.12  #define HAVE_NANOSLEEP  1
     6.1 --- a/include/SDL_config_iphoneos.h	Sat Jun 07 17:31:50 2014 -0700
     6.2 +++ b/include/SDL_config_iphoneos.h	Sat Jun 07 18:20:01 2014 -0700
     6.3 @@ -98,6 +98,9 @@
     6.4  #define HAVE_SIN    1
     6.5  #define HAVE_SINF   1
     6.6  #define HAVE_SQRT   1
     6.7 +#define HAVE_SQRTF  1
     6.8 +#define HAVE_TAN    1
     6.9 +#define HAVE_TANF   1
    6.10  #define HAVE_SIGACTION  1
    6.11  #define HAVE_SETJMP 1
    6.12  #define HAVE_NANOSLEEP  1
     7.1 --- a/include/SDL_config_macosx.h	Sat Jun 07 17:31:50 2014 -0700
     7.2 +++ b/include/SDL_config_macosx.h	Sat Jun 07 18:20:01 2014 -0700
     7.3 @@ -96,6 +96,9 @@
     7.4  #define HAVE_SIN    1
     7.5  #define HAVE_SINF   1
     7.6  #define HAVE_SQRT   1
     7.7 +#define HAVE_SQRTF  1
     7.8 +#define HAVE_TAN    1
     7.9 +#define HAVE_TANF   1
    7.10  #define HAVE_SIGACTION  1
    7.11  #define HAVE_SETJMP 1
    7.12  #define HAVE_NANOSLEEP  1
     8.1 --- a/include/SDL_config_pandora.h	Sat Jun 07 17:31:50 2014 -0700
     8.2 +++ b/include/SDL_config_pandora.h	Sat Jun 07 18:20:01 2014 -0700
     8.3 @@ -95,6 +95,9 @@
     8.4  #define HAVE_SIN 1
     8.5  #define HAVE_SINF 1
     8.6  #define HAVE_SQRT 1
     8.7 +#define HAVE_SQRTF 1
     8.8 +#define HAVE_TAN 1
     8.9 +#define HAVE_TANF 1
    8.10  #define HAVE_SIGACTION 1
    8.11  #define HAVE_SETJMP 1
    8.12  #define HAVE_NANOSLEEP 1
     9.1 --- a/include/SDL_config_psp.h	Sat Jun 07 17:31:50 2014 -0700
     9.2 +++ b/include/SDL_config_psp.h	Sat Jun 07 18:20:01 2014 -0700
     9.3 @@ -98,6 +98,9 @@
     9.4  #define HAVE_SIN    1
     9.5  #define HAVE_SINF   1
     9.6  #define HAVE_SQRT   1
     9.7 +#define HAVE_SQRTF  1
     9.8 +#define HAVE_TAN    1
     9.9 +#define HAVE_TANF   1
    9.10  #define HAVE_SETJMP 1
    9.11  #define HAVE_NANOSLEEP  1
    9.12  /* #define HAVE_SYSCONF  1 */
    10.1 --- a/include/SDL_config_windows.h	Sat Jun 07 17:31:50 2014 -0700
    10.2 +++ b/include/SDL_config_windows.h	Sat Jun 07 18:20:01 2014 -0700
    10.3 @@ -132,6 +132,9 @@
    10.4  #define HAVE_SIN 1
    10.5  #define HAVE_SINF 1
    10.6  #define HAVE_SQRT 1
    10.7 +#define HAVE_SQRTF 1
    10.8 +#define HAVE_TAN 1
    10.9 +#define HAVE_TANF 1
   10.10  #if _MSC_VER >= 1800
   10.11  #define HAVE_STRTOLL 1
   10.12  #define HAVE_VSSCANF 1
    11.1 --- a/include/SDL_config_winrt.h	Sat Jun 07 17:31:50 2014 -0700
    11.2 +++ b/include/SDL_config_winrt.h	Sat Jun 07 18:20:01 2014 -0700
    11.3 @@ -137,6 +137,9 @@
    11.4  #define HAVE_SIN 1
    11.5  #define HAVE_SINF 1
    11.6  #define HAVE_SQRT 1
    11.7 +#define HAVE_SQRTF 1
    11.8 +#define HAVE_TAN 1
    11.9 +#define HAVE_TANF 1
   11.10  #define HAVE__FSEEKI64 1
   11.11  
   11.12  /* Enable various audio drivers */
    12.1 --- a/include/SDL_config_wiz.h	Sat Jun 07 17:31:50 2014 -0700
    12.2 +++ b/include/SDL_config_wiz.h	Sat Jun 07 18:20:01 2014 -0700
    12.3 @@ -89,6 +89,9 @@
    12.4  #define HAVE_SIN 1
    12.5  #define HAVE_SINF 1
    12.6  #define HAVE_SQRT 1
    12.7 +#define HAVE_SQRTF 1
    12.8 +#define HAVE_TAN 1
    12.9 +#define HAVE_TANF 1
   12.10  #define HAVE_SIGACTION 1
   12.11  #define HAVE_SETJMP 1
   12.12  #define HAVE_NANOSLEEP 1
    13.1 --- a/include/SDL_stdinc.h	Sat Jun 07 17:31:50 2014 -0700
    13.2 +++ b/include/SDL_stdinc.h	Sat Jun 07 18:20:01 2014 -0700
    13.3 @@ -411,6 +411,9 @@
    13.4  extern DECLSPEC double SDLCALL SDL_sin(double x);
    13.5  extern DECLSPEC float SDLCALL SDL_sinf(float x);
    13.6  extern DECLSPEC double SDLCALL SDL_sqrt(double x);
    13.7 +extern DECLSPEC float SDLCALL SDL_sqrtf(float x);
    13.8 +extern DECLSPEC double SDLCALL SDL_tan(double x);
    13.9 +extern DECLSPEC float SDLCALL SDL_tanf(float x);
   13.10  
   13.11  /* The SDL implementation of iconv() returns these error codes */
   13.12  #define SDL_ICONV_ERROR     (size_t)-1
    14.1 --- a/src/dynapi/SDL_dynapi_overrides.h	Sat Jun 07 17:31:50 2014 -0700
    14.2 +++ b/src/dynapi/SDL_dynapi_overrides.h	Sat Jun 07 18:20:01 2014 -0700
    14.3 @@ -581,3 +581,6 @@
    14.4  #define SDL_WinRTGetFSPathUNICODE SDL_WinRTGetFSPathUNICODE_REAL
    14.5  #define SDL_WinRTGetFSPathUTF8 SDL_WinRTGetFSPathUTF8_REAL
    14.6  #define SDL_WinRTRunApp SDL_WinRTRunApp_REAL
    14.7 +#define SDL_sqrtf SDL_sqrtf_REAL
    14.8 +#define SDL_tan SDL_tan_REAL
    14.9 +#define SDL_tanf SDL_tanf_REAL
    15.1 --- a/src/dynapi/SDL_dynapi_procs.h	Sat Jun 07 17:31:50 2014 -0700
    15.2 +++ b/src/dynapi/SDL_dynapi_procs.h	Sat Jun 07 18:20:01 2014 -0700
    15.3 @@ -613,3 +613,6 @@
    15.4  SDL_DYNAPI_PROC(const char*,SDL_WinRTGetFSPathUTF8,(SDL_WinRT_Path a),(a),return)
    15.5  #endif
    15.6  SDL_DYNAPI_PROC(void,SDL_WarpMouseGlobal,(int a, int b),(a,b),)
    15.7 +SDL_DYNAPI_PROC(float,SDL_sqrtf,(float a),(a),return)
    15.8 +SDL_DYNAPI_PROC(double,SDL_tan,(double a),(a),return)
    15.9 +SDL_DYNAPI_PROC(float,SDL_tanf,(float a),(a),return)
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/src/libm/k_tan.c	Sat Jun 07 18:20:01 2014 -0700
    16.3 @@ -0,0 +1,118 @@
    16.4 +/*
    16.5 + * ====================================================
    16.6 + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
    16.7 + *
    16.8 + * Developed at SunPro, a Sun Microsystems, Inc. business.
    16.9 + * Permission to use, copy, modify, and distribute this
   16.10 + * software is freely granted, provided that this notice
   16.11 + * is preserved.
   16.12 + * ====================================================
   16.13 + */
   16.14 +
   16.15 +/* __kernel_tan( x, y, k )
   16.16 + * kernel tan function on [-pi/4, pi/4], pi/4 ~ 0.7854
   16.17 + * Input x is assumed to be bounded by ~pi/4 in magnitude.
   16.18 + * Input y is the tail of x.
   16.19 + * Input k indicates whether tan (if k=1) or
   16.20 + * -1/tan (if k= -1) is returned.
   16.21 + *
   16.22 + * Algorithm
   16.23 + *	1. Since tan(-x) = -tan(x), we need only to consider positive x.
   16.24 + *	2. if x < 2^-28 (hx<0x3e300000 0), return x with inexact if x!=0.
   16.25 + *	3. tan(x) is approximated by a odd polynomial of degree 27 on
   16.26 + *	   [0,0.67434]
   16.27 + *		  	         3             27
   16.28 + *	   	tan(x) ~ x + T1*x + ... + T13*x
   16.29 + *	   where
   16.30 + *
   16.31 + * 	        |tan(x)         2     4            26   |     -59.2
   16.32 + * 	        |----- - (1+T1*x +T2*x +.... +T13*x    )| <= 2
   16.33 + * 	        |  x 					|
   16.34 + *
   16.35 + *	   Note: tan(x+y) = tan(x) + tan'(x)*y
   16.36 + *		          ~ tan(x) + (1+x*x)*y
   16.37 + *	   Therefore, for better accuracy in computing tan(x+y), let
   16.38 + *		     3      2      2       2       2
   16.39 + *		r = x *(T2+x *(T3+x *(...+x *(T12+x *T13))))
   16.40 + *	   then
   16.41 + *		 		    3    2
   16.42 + *		tan(x+y) = x + (T1*x + (x *(r+y)+y))
   16.43 + *
   16.44 + *      4. For x in [0.67434,pi/4],  let y = pi/4 - x, then
   16.45 + *		tan(x) = tan(pi/4-y) = (1-tan(y))/(1+tan(y))
   16.46 + *		       = 1 - 2*(tan(y) - (tan(y)^2)/(1+tan(y)))
   16.47 + */
   16.48 +
   16.49 +#include "math_libm.h"
   16.50 +#include "math_private.h"
   16.51 +
   16.52 +static const double
   16.53 +one   =  1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
   16.54 +pio4  =  7.85398163397448278999e-01, /* 0x3FE921FB, 0x54442D18 */
   16.55 +pio4lo=  3.06161699786838301793e-17, /* 0x3C81A626, 0x33145C07 */
   16.56 +T[] =  {
   16.57 +  3.33333333333334091986e-01, /* 0x3FD55555, 0x55555563 */
   16.58 +  1.33333333333201242699e-01, /* 0x3FC11111, 0x1110FE7A */
   16.59 +  5.39682539762260521377e-02, /* 0x3FABA1BA, 0x1BB341FE */
   16.60 +  2.18694882948595424599e-02, /* 0x3F9664F4, 0x8406D637 */
   16.61 +  8.86323982359930005737e-03, /* 0x3F8226E3, 0xE96E8493 */
   16.62 +  3.59207910759131235356e-03, /* 0x3F6D6D22, 0xC9560328 */
   16.63 +  1.45620945432529025516e-03, /* 0x3F57DBC8, 0xFEE08315 */
   16.64 +  5.88041240820264096874e-04, /* 0x3F4344D8, 0xF2F26501 */
   16.65 +  2.46463134818469906812e-04, /* 0x3F3026F7, 0x1A8D1068 */
   16.66 +  7.81794442939557092300e-05, /* 0x3F147E88, 0xA03792A6 */
   16.67 +  7.14072491382608190305e-05, /* 0x3F12B80F, 0x32F0A7E9 */
   16.68 + -1.85586374855275456654e-05, /* 0xBEF375CB, 0xDB605373 */
   16.69 +  2.59073051863633712884e-05, /* 0x3EFB2A70, 0x74BF7AD4 */
   16.70 +};
   16.71 +
   16.72 +double __kernel_tan(double x, double y, int iy)
   16.73 +{
   16.74 +	double z,r,v,w,s;
   16.75 +	int32_t ix,hx;
   16.76 +	GET_HIGH_WORD(hx,x);
   16.77 +	ix = hx&0x7fffffff;	/* high word of |x| */
   16.78 +	if(ix<0x3e300000)			/* x < 2**-28 */
   16.79 +	    {if((int)x==0) {			/* generate inexact */
   16.80 +	        u_int32_t low;
   16.81 +		GET_LOW_WORD(low,x);
   16.82 +		if(((ix|low)|(iy+1))==0) return one/fabs(x);
   16.83 +		else return (iy==1)? x: -one/x;
   16.84 +	    }
   16.85 +	    }
   16.86 +	if(ix>=0x3FE59428) { 			/* |x|>=0.6744 */
   16.87 +	    if(hx<0) {x = -x; y = -y;}
   16.88 +	    z = pio4-x;
   16.89 +	    w = pio4lo-y;
   16.90 +	    x = z+w; y = 0.0;
   16.91 +	}
   16.92 +	z	=  x*x;
   16.93 +	w 	=  z*z;
   16.94 +    /* Break x^5*(T[1]+x^2*T[2]+...) into
   16.95 +     *	  x^5(T[1]+x^4*T[3]+...+x^20*T[11]) +
   16.96 +     *	  x^5(x^2*(T[2]+x^4*T[4]+...+x^22*[T12]))
   16.97 +     */
   16.98 +	r = T[1]+w*(T[3]+w*(T[5]+w*(T[7]+w*(T[9]+w*T[11]))));
   16.99 +	v = z*(T[2]+w*(T[4]+w*(T[6]+w*(T[8]+w*(T[10]+w*T[12])))));
  16.100 +	s = z*x;
  16.101 +	r = y + z*(s*(r+v)+y);
  16.102 +	r += T[0]*s;
  16.103 +	w = x+r;
  16.104 +	if(ix>=0x3FE59428) {
  16.105 +	    v = (double)iy;
  16.106 +	    return (double)(1-((hx>>30)&2))*(v-2.0*(x-(w*w/(w+v)-r)));
  16.107 +	}
  16.108 +	if(iy==1) return w;
  16.109 +	else {		/* if allow error up to 2 ulp,
  16.110 +			   simply return -1.0/(x+r) here */
  16.111 +     /*  compute -1.0/(x+r) accurately */
  16.112 +	    double a,t;
  16.113 +	    z  = w;
  16.114 +	    SET_LOW_WORD(z,0);
  16.115 +	    v  = r-(z - x); 	/* z+v = r+x */
  16.116 +	    t = a  = -1.0/w;	/* a = -1.0/w */
  16.117 +	    SET_LOW_WORD(t,0);
  16.118 +	    s  = 1.0+t*z;
  16.119 +	    return t+a*(s+t*v);
  16.120 +	}
  16.121 +}
    17.1 --- a/src/libm/math_libm.h	Sat Jun 07 17:31:50 2014 -0700
    17.2 +++ b/src/libm/math_libm.h	Sat Jun 07 18:20:01 2014 -0700
    17.3 @@ -33,5 +33,6 @@
    17.4  double SDL_uclibc_scalbn(double x, int n);
    17.5  double SDL_uclibc_sin(double x);
    17.6  double SDL_uclibc_sqrt(double x);
    17.7 +double SDL_uclibc_tan(double x);
    17.8  
    17.9  /* vi: set ts=4 sw=4 expandtab: */
    18.1 --- a/src/libm/math_private.h	Sat Jun 07 17:31:50 2014 -0700
    18.2 +++ b/src/libm/math_private.h	Sat Jun 07 18:20:01 2014 -0700
    18.3 @@ -40,6 +40,7 @@
    18.4  #define scalbn          SDL_uclibc_scalbn
    18.5  #define sin             SDL_uclibc_sin
    18.6  #define __ieee754_sqrt  SDL_uclibc_sqrt
    18.7 +#define tan             SDL_uclibc_tan
    18.8  
    18.9  /* The original fdlibm code used statements like:
   18.10  	n0 = ((*(int*)&one)>>29)^1;		* index of high word *
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/src/libm/s_tan.c	Sat Jun 07 18:20:01 2014 -0700
    19.3 @@ -0,0 +1,67 @@
    19.4 +/*
    19.5 + * ====================================================
    19.6 + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
    19.7 + *
    19.8 + * Developed at SunPro, a Sun Microsystems, Inc. business.
    19.9 + * Permission to use, copy, modify, and distribute this
   19.10 + * software is freely granted, provided that this notice
   19.11 + * is preserved.
   19.12 + * ====================================================
   19.13 + */
   19.14 +
   19.15 +/* tan(x)
   19.16 + * Return tangent function of x.
   19.17 + *
   19.18 + * kernel function:
   19.19 + *	__kernel_tan		... tangent function on [-pi/4,pi/4]
   19.20 + *	__ieee754_rem_pio2	... argument reduction routine
   19.21 + *
   19.22 + * Method.
   19.23 + *      Let S,C and T denote the sin, cos and tan respectively on
   19.24 + *	[-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2
   19.25 + *	in [-pi/4 , +pi/4], and let n = k mod 4.
   19.26 + *	We have
   19.27 + *
   19.28 + *          n        sin(x)      cos(x)        tan(x)
   19.29 + *     ----------------------------------------------------------
   19.30 + *	    0	       S	   C		 T
   19.31 + *	    1	       C	  -S		-1/T
   19.32 + *	    2	      -S	  -C		 T
   19.33 + *	    3	      -C	   S		-1/T
   19.34 + *     ----------------------------------------------------------
   19.35 + *
   19.36 + * Special cases:
   19.37 + *      Let trig be any of sin, cos, or tan.
   19.38 + *      trig(+-INF)  is NaN, with signals;
   19.39 + *      trig(NaN)    is that NaN;
   19.40 + *
   19.41 + * Accuracy:
   19.42 + *	TRIG(x) returns trig(x) nearly rounded
   19.43 + */
   19.44 +
   19.45 +#include "math.h"
   19.46 +#include "math_private.h"
   19.47 +
   19.48 +double tan(double x)
   19.49 +{
   19.50 +	double y[2],z=0.0;
   19.51 +	int32_t n, ix;
   19.52 +
   19.53 +    /* High word of x. */
   19.54 +	GET_HIGH_WORD(ix,x);
   19.55 +
   19.56 +    /* |x| ~< pi/4 */
   19.57 +	ix &= 0x7fffffff;
   19.58 +	if(ix <= 0x3fe921fb) return __kernel_tan(x,z,1);
   19.59 +
   19.60 +    /* tan(Inf or NaN) is NaN */
   19.61 +	else if (ix>=0x7ff00000) return x-x;		/* NaN */
   19.62 +
   19.63 +    /* argument reduction needed */
   19.64 +	else {
   19.65 +	    n = __ieee754_rem_pio2(x,y);
   19.66 +	    return __kernel_tan(y[0],y[1],1-((n&1)<<1)); /*   1 -- n even
   19.67 +							-1 -- n odd */
   19.68 +	}
   19.69 +}
   19.70 +libm_hidden_def(tan)
    20.1 --- a/src/stdlib/SDL_stdlib.c	Sat Jun 07 17:31:50 2014 -0700
    20.2 +++ b/src/stdlib/SDL_stdlib.c	Sat Jun 07 18:20:01 2014 -0700
    20.3 @@ -211,6 +211,36 @@
    20.4  #endif
    20.5  }
    20.6  
    20.7 +float
    20.8 +SDL_sqrtf(float x)
    20.9 +{
   20.10 +#if defined(HAVE_SQRTF)
   20.11 +    return sqrtf(x);
   20.12 +#else
   20.13 +    return (float)SDL_sqrt((double)x);
   20.14 +#endif
   20.15 +}
   20.16 +
   20.17 +double
   20.18 +SDL_tan(double x)
   20.19 +{
   20.20 +#if defined(HAVE_TAN)
   20.21 +    return tan(x);
   20.22 +#else
   20.23 +    return SDL_uclibc_tan(x);
   20.24 +#endif
   20.25 +}
   20.26 +
   20.27 +float
   20.28 +SDL_tanf(float x)
   20.29 +{
   20.30 +#if defined(HAVE_TANF)
   20.31 +    return tanf(x);
   20.32 +#else
   20.33 +    return (float)SDL_tan((double)x);
   20.34 +#endif
   20.35 +}
   20.36 +
   20.37  int SDL_abs(int x)
   20.38  {
   20.39  #ifdef HAVE_ABS