src/stdlib/SDL_stdlib.c
changeset 11682 b26412a89fbb
parent 11404 bd5b569b2a1b
child 11684 eccdf37f8996
     1.1 --- a/src/stdlib/SDL_stdlib.c	Sat Nov 04 09:44:29 2017 -0700
     1.2 +++ b/src/stdlib/SDL_stdlib.c	Sat Nov 04 15:34:14 2017 -0700
     1.3 @@ -38,7 +38,17 @@
     1.4      return atan(x);
     1.5  #else
     1.6      return SDL_uclibc_atan(x);
     1.7 -#endif /* HAVE_ATAN */
     1.8 +#endif
     1.9 +}
    1.10 +
    1.11 +float
    1.12 +SDL_atanf(float x)
    1.13 +{
    1.14 +#if defined(HAVE_ATANF)
    1.15 +    return atanf(x);
    1.16 +#else
    1.17 +    return (float)SDL_atan((double)x);
    1.18 +#endif
    1.19  }
    1.20  
    1.21  double
    1.22 @@ -48,7 +58,17 @@
    1.23      return atan2(x, y);
    1.24  #else
    1.25      return SDL_uclibc_atan2(x, y);
    1.26 -#endif /* HAVE_ATAN2 */
    1.27 +#endif
    1.28 +}
    1.29 +
    1.30 +float
    1.31 +SDL_atan2f(float x, float y)
    1.32 +{
    1.33 +#if defined(HAVE_ATAN2F)
    1.34 +    return atan2f(x, y);
    1.35 +#else
    1.36 +    return (float)SDL_atan2((double)x, (double)y);
    1.37 +#endif
    1.38  }
    1.39  
    1.40  double
    1.41 @@ -71,6 +91,16 @@
    1.42  #endif
    1.43  }
    1.44  
    1.45 +float
    1.46 +SDL_acosf(float val)
    1.47 +{
    1.48 +#if defined(HAVE_ACOSF)
    1.49 +    return acosf(val);
    1.50 +#else
    1.51 +    return (float)SDL_acos((double)val);
    1.52 +#endif
    1.53 +}
    1.54 +
    1.55  double
    1.56  SDL_asin(double val)
    1.57  {
    1.58 @@ -87,6 +117,16 @@
    1.59  #endif
    1.60  }
    1.61  
    1.62 +float
    1.63 +SDL_asinf(float val)
    1.64 +{
    1.65 +#if defined(HAVE_ASINF)
    1.66 +    return asinf(val);
    1.67 +#else
    1.68 +    return (float)SDL_asin((double)val);
    1.69 +#endif
    1.70 +}
    1.71 +
    1.72  double
    1.73  SDL_ceil(double x)
    1.74  {
    1.75 @@ -102,6 +142,16 @@
    1.76  #endif /* HAVE_CEIL */
    1.77  }
    1.78  
    1.79 +float
    1.80 +SDL_ceilf(float x)
    1.81 +{
    1.82 +#if defined(HAVE_CEILF)
    1.83 +    return ceilf(x);
    1.84 +#else
    1.85 +    return (float)ceil((float)x);
    1.86 +#endif
    1.87 +}
    1.88 +
    1.89  double
    1.90  SDL_copysign(double x, double y)
    1.91  {
    1.92 @@ -120,6 +170,16 @@
    1.93  #endif /* HAVE_COPYSIGN */
    1.94  }
    1.95  
    1.96 +float
    1.97 +SDL_copysignf(float x, float y)
    1.98 +{
    1.99 +#if defined(HAVE_COPYSIGNF)
   1.100 +    return copysignf(x, y);
   1.101 +#else
   1.102 +    return (float)SDL_copysign((double)x, (double)y);
   1.103 +#endif
   1.104 +}
   1.105 +
   1.106  double
   1.107  SDL_cos(double x)
   1.108  {
   1.109 @@ -127,7 +187,7 @@
   1.110      return cos(x);
   1.111  #else
   1.112      return SDL_uclibc_cos(x);
   1.113 -#endif /* HAVE_COS */
   1.114 +#endif
   1.115  }
   1.116  
   1.117  float
   1.118 @@ -147,7 +207,17 @@
   1.119      return fabs(x); 
   1.120  #else
   1.121      return SDL_uclibc_fabs(x);
   1.122 -#endif /* HAVE_FABS */
   1.123 +#endif
   1.124 +}
   1.125 +
   1.126 +float
   1.127 +SDL_fabsf(float x)
   1.128 +{
   1.129 +#if defined(HAVE_FABSF)
   1.130 +    return fabsf(x); 
   1.131 +#else
   1.132 +    return (float)SDL_fabs((double)x);
   1.133 +#endif
   1.134  }
   1.135  
   1.136  double
   1.137 @@ -157,7 +227,17 @@
   1.138      return floor(x);
   1.139  #else
   1.140      return SDL_uclibc_floor(x);
   1.141 -#endif /* HAVE_FLOOR */
   1.142 +#endif
   1.143 +}
   1.144 +
   1.145 +float
   1.146 +SDL_floorf(float x)
   1.147 +{
   1.148 +#if defined(HAVE_FLOORF)
   1.149 +    return floorf(x);
   1.150 +#else
   1.151 +    return (float)SDL_floor((double)x);
   1.152 +#endif
   1.153  }
   1.154  
   1.155  double
   1.156 @@ -167,7 +247,17 @@
   1.157      return log(x);
   1.158  #else
   1.159      return SDL_uclibc_log(x);
   1.160 -#endif /* HAVE_LOG */
   1.161 +#endif
   1.162 +}
   1.163 +
   1.164 +float
   1.165 +SDL_logf(float x)
   1.166 +{
   1.167 +#if defined(HAVE_LOGF)
   1.168 +    return logf(x);
   1.169 +#else
   1.170 +    return (float)SDL_log((double)x);
   1.171 +#endif
   1.172  }
   1.173  
   1.174  double
   1.175 @@ -177,7 +267,17 @@
   1.176      return pow(x, y);
   1.177  #else
   1.178      return SDL_uclibc_pow(x, y);
   1.179 -#endif /* HAVE_POW */
   1.180 +#endif
   1.181 +}
   1.182 +
   1.183 +float
   1.184 +SDL_powf(float x, float y)
   1.185 +{
   1.186 +#if defined(HAVE_POWF)
   1.187 +    return powf(x, y);
   1.188 +#else
   1.189 +    return (float)SDL_pow((double)x, (double)y);
   1.190 +#endif
   1.191  }
   1.192  
   1.193  double
   1.194 @@ -193,7 +293,17 @@
   1.195      return ldexp(x, n);
   1.196  #else
   1.197      return SDL_uclibc_scalbn(x, n);
   1.198 -#endif /* HAVE_SCALBN */
   1.199 +#endif
   1.200 +}
   1.201 +
   1.202 +float
   1.203 +SDL_scalbnf(float x, int n)
   1.204 +{
   1.205 +#if defined(HAVE_SCALBNF)
   1.206 +    return scalbnf(x, n);
   1.207 +#else
   1.208 +    return (float)SDL_scalbn((double)x, n);
   1.209 +#endif
   1.210  }
   1.211  
   1.212  double
   1.213 @@ -203,7 +313,7 @@
   1.214      return sin(x);
   1.215  #else
   1.216      return SDL_uclibc_sin(x);
   1.217 -#endif /* HAVE_SIN */
   1.218 +#endif
   1.219  }
   1.220  
   1.221  float 
   1.222 @@ -213,7 +323,7 @@
   1.223      return sinf(x);
   1.224  #else
   1.225      return (float)SDL_sin((double)x);
   1.226 -#endif /* HAVE_SINF */
   1.227 +#endif
   1.228  }
   1.229  
   1.230  double