Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. /*      Copyright (C) 2006 Garrett A. Kajmowicz
  2.  
  3.         This file is part of the uClibc++ Library.
  4.  
  5.         This library is free software; you can redistribute it and/or
  6.         modify it under the terms of the GNU Lesser General Public
  7.         License as published by the Free Software Foundation; either
  8.         version 2.1 of the License, or (at your option) any later version.
  9.  
  10.         This library is distributed in the hope that it will be useful,
  11.         but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.         Lesser General Public License for more details.
  14.  
  15.         You should have received a copy of the GNU Lesser General Public
  16.         License along with this library; if not, write to the Free Software
  17.         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18. */
  19.  
  20. #include <math.h>
  21.  
  22. #ifndef __STD_HEADER_CMATH
  23. #define __STD_HEADER_CMATH 1
  24.  
  25. #undef abs
  26. #undef acos
  27. #undef asin
  28. #undef atan
  29. #undef atan2
  30. #undef ceil
  31. #undef cos
  32. #undef cosh
  33. #undef exp
  34. #undef fabs
  35. #undef floor
  36. #undef fmod
  37. #undef frexp
  38. #undef ldexp
  39. #undef log
  40. #undef log10
  41. #undef modf
  42. #undef pow
  43. #undef sin
  44. #undef sinh
  45. #undef sqrt
  46. #undef tan
  47. #undef tanh
  48.  
  49. namespace std {
  50.  
  51.         using ::acos;
  52.         using ::asin;
  53.         using ::atan;
  54.         using ::atan2;
  55.         using ::ceil;
  56.         using ::cos;
  57.         using ::cosh;
  58.         using ::exp;
  59.         using ::fabs;
  60.         using ::floor;
  61.         using ::fmod;
  62.         using ::frexp;
  63.         using ::ldexp;
  64.         using ::log;
  65.         using ::log10;
  66.         using ::modf;
  67.         using ::pow;
  68.         using ::sin;
  69.         using ::sinh;
  70.         using ::sqrt;
  71.         using ::tan;
  72.         using ::tanh;
  73.  
  74. #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
  75.         inline float abs  (float x){
  76.                 return fabsf(x);
  77.         }
  78.         inline float acos (float x){
  79.                 return acosf(x);
  80.         }
  81.         inline float asin (float x){
  82.                 return asinf(x);
  83.         }
  84.         inline float atan (float x){
  85.                 return atanf(x);
  86.         }
  87.         inline float atan2(float y, float x){
  88.                 return atan2f(y, x);
  89.         }
  90.         inline float ceil (float x){
  91.                 return ceilf(x);
  92.         }
  93.         inline float cos  (float x){
  94.                 return cosf(x);
  95.         }
  96.         inline float cosh (float x){
  97.                 return coshf(x);
  98.         }
  99.         inline float exp  (float x){
  100.                 return expf(x);
  101.         }
  102.         inline float fabs (float x){
  103.                 return fabsf(x);
  104.         }
  105.         inline float floor(float x){
  106.                 return floorf(x);
  107.         }
  108.         inline float fmod (float x, float y){
  109.                 return fmodf(x, y);
  110.         }
  111.         inline float frexp(float x, int* exp){
  112.                 return frexpf(x, exp);
  113.         }
  114.         inline float ldexp(float x, int exp){
  115.                 return ldexpf(x, exp);
  116.         }
  117.         inline float log  (float x){
  118.                 return logf(x);
  119.         }
  120.         inline float log10(float x){
  121.                 return log10f(x);
  122.         }
  123.         inline float modf (float x, float* inptr){
  124.                 return modff(x, inptr);
  125.         }
  126.         inline float pow  (float x, float y){
  127.                 return powf(x, y);
  128.         }
  129. #if 1 // DR 550 removed this
  130.         inline float pow  (float x, int y){
  131.                 return pow((double)x, (double)y);
  132.         }
  133. #endif
  134.         inline float sin  (float x){
  135.                 return sinf(x);
  136.         }
  137.         inline float sinh (float x){
  138.                 return sinhf(x);
  139.         }
  140.         inline float sqrt (float x){
  141.                 return sqrtf(x);
  142.         }
  143.         inline float tan  (float x){
  144.                 return tanf(x);
  145.         }
  146.         inline float tanh (float x){
  147.                 return tanhf(x);
  148.         }
  149.         inline double abs(double x){
  150.                 return fabs(x);
  151.         }
  152.         inline double pow(double x, int y){
  153.                 return pow((double)x, (double)y);
  154.         }
  155.  
  156. # ifdef __UCLIBCXX_HAS_LONG_DOUBLE__
  157.         inline long double abs  (long double x){
  158.                 return fabsl(x);
  159.         }
  160.         inline long double acos (long double x){
  161.                 return acosl(x);
  162.         }
  163.         inline long double asin (long double x){
  164.                 return asinl(x);
  165.         }
  166.         inline long double atan (long double x){
  167.                 return atanl(x);
  168.         }
  169.         inline long double atan2(long double y, long double x){
  170.                 return atan2l(y, x);
  171.         }
  172.         inline long double ceil (long double x){
  173.                 return ceill(x);
  174.         }
  175.         inline long double cos  (long double x){
  176.                 return cosl(x);
  177.         }
  178.         inline long double cosh (long double x){
  179.                 return coshl(x);
  180.         }
  181.         inline long double exp  (long double x){
  182.                 return expl(x);
  183.         }
  184.         inline long double fabs (long double x){
  185.                 return fabsl(x);
  186.         }
  187.         inline long double floor(long double x){
  188.                 return floorl(x);
  189.         }
  190.         inline long double frexp(long double x, int* exp){
  191.                 return frexpl(x, exp);
  192.         }
  193.         inline long double fmod (long double x, long double y){
  194.                 return fmodl(x, y);
  195.         }
  196.         inline long double ldexp(long double x, int y){
  197.                 return ldexpl(x, y);
  198.         }
  199.         inline long double log  (long double x){
  200.                 return logl(x);
  201.         }
  202.         inline long double log10(long double x){
  203.                 return log10l(x);
  204.         }
  205.         inline long double modf (long double x, long double* iptr){
  206.                 return modfl(x, iptr);
  207.         }
  208.         inline long double pow  (long double x, long double y){
  209.                 return powl(x, y);
  210.         }
  211.         inline long double pow  (long double x, int y){
  212.                 return powl(x, (long double)y );
  213.         }
  214.         inline long double sin  (long double x){
  215.                 return sinl(x);
  216.         }
  217.         inline long double sinh (long double x){
  218.                 return sinhl(x);
  219.         }
  220.         inline long double sqrt (long double x){
  221.                 return sqrtl(x);
  222.         }
  223.         inline long double tan  (long double x){
  224.                 return tanl(x);
  225.         }
  226.         inline long double tanh (long double x){
  227.                 return tanhl(x);
  228.         }
  229. # endif //       __UCLIBCXX_HAS_LONG_DOUBLE__
  230. #endif  //       __CORRECT_ISO_CPP_MATH_H_PROTO
  231. }
  232.  
  233. #endif  //__STD_HEADER_CMATH
  234.  
  235.