Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. // Stub definitions for long double math.
  2.  
  3. // Copyright (C) 2001-2015 Free Software Foundation, Inc.
  4. //
  5. // This file is part of the GNU ISO C++ Library.  This library is free
  6. // software; you can redistribute it and/or modify it under the
  7. // terms of the GNU General Public License as published by the
  8. // Free Software Foundation; either version 3, or (at your option)
  9. // any later version.
  10.  
  11. // This library is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. // GNU General Public License for more details.
  15.  
  16. // Under Section 7 of GPL version 3, you are granted additional
  17. // permissions described in the GCC Runtime Library Exception, version
  18. // 3.1, as published by the Free Software Foundation.
  19.  
  20. // You should have received a copy of the GNU General Public License and
  21. // a copy of the GCC Runtime Library Exception along with this program;
  22. // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
  23. // <http://www.gnu.org/licenses/>.
  24.  
  25. #include <cmath>
  26.  
  27. // For targets which do not have support for long double versions,
  28. // we use the following crude approximations. We keep saying that we'll do
  29. // better later, but never do.
  30.  
  31. extern "C"
  32. {
  33. #ifndef _GLIBCXX_HAVE_FABSL
  34.   long double
  35.   fabsl(long double x)
  36.   {
  37.     return fabs((double) x);
  38.   }
  39. #endif
  40.  
  41. #ifndef _GLIBCXX_HAVE_ACOSL
  42.   long double
  43.   acosl(long double x)
  44.   {
  45.     return acos((double) x);
  46.   }
  47. #endif
  48.  
  49. #ifndef _GLIBCXX_HAVE_ASINL
  50.   long double
  51.   asinl(long double x)
  52.   {
  53.     return asin((double) x);
  54.   }
  55. #endif
  56.  
  57. #ifndef _GLIBCXX_HAVE_ATANL
  58.   long double
  59.   atanl(long double x)
  60.   {
  61.     return atan ((double) x);
  62.   }
  63. #endif
  64.  
  65. #ifndef _GLIBCXX_HAVE_ATAN2L
  66.   long double
  67.   atan2l(long double x, long double y)
  68.   {
  69.     return atan2((double) x, (double) y);
  70.   }
  71. #endif
  72.  
  73. #ifndef _GLIBCXX_HAVE_CEILL
  74.   long double
  75.   ceill(long double x)
  76.   {
  77.     return ceil((double) x);
  78.   }
  79. #endif
  80.  
  81. #ifndef _GLIBCXX_HAVE_COSL
  82.   long double
  83.   cosl(long double x)
  84.   {
  85.     return cos((double) x);
  86.   }
  87. #endif
  88.  
  89. #ifndef _GLIBCXX_HAVE_COSHL
  90.   long double
  91.   coshl(long double x)
  92.   {
  93.     return cosh((double) x);
  94.   }
  95. #endif
  96.  
  97. #ifndef _GLIBCXX_HAVE_EXPL
  98.   long double
  99.   expl(long double x)
  100.   {
  101.     return exp((double) x);
  102.   }
  103. #endif
  104.  
  105. #ifndef _GLIBCXX_HAVE_FLOORL
  106.   long double
  107.   floorl(long double x)
  108.   {
  109.     return floor((double) x);
  110.   }
  111. #endif
  112.  
  113. #ifndef _GLIBCXX_HAVE_FMODL
  114.   long double
  115.   fmodl(long double x, long double y)
  116.   {
  117.     return fmod((double) x, (double) y);
  118.   }
  119. #endif
  120.  
  121. #ifndef _GLIBCXX_HAVE_FREXPL
  122.   long double
  123.   frexpl(long double x, int *exp)
  124.   {
  125.     return frexp((double) x, exp);
  126.   }
  127. #endif
  128.  
  129. #ifndef _GLIBCXX_HAVE_SQRTL
  130.   long double
  131.   sqrtl(long double x)
  132.   {
  133.     return  sqrt((double) x);
  134.   }
  135. #endif
  136.  
  137. #ifndef _GLIBCXX_HAVE_HYPOTL
  138.   long double
  139.   hypotl(long double x, long double y)
  140.   {
  141.     long double s = fabsl(x) + fabsl(y);
  142.     if (s == 0.0L)
  143.       return s;
  144.     x /= s; y /= s;
  145.     return s * sqrtl(x * x + y * y);
  146.   }
  147. #endif
  148.  
  149. #ifndef _GLIBCXX_HAVE_LDEXPL
  150.   long double
  151.   ldexpl(long double x, int exp)
  152.   {
  153.     return ldexp((double) x, exp);
  154.   }
  155. #endif
  156.  
  157. #ifndef _GLIBCXX_HAVE_LOGL
  158.   long double
  159.   logl(long double x)
  160.   {
  161.     return log((double) x);
  162.   }
  163. #endif
  164.  
  165. #ifndef _GLIBCXX_HAVE_LOG10L
  166.   long double
  167.   log10l(long double x)
  168.   {
  169.     return log10((double) x);
  170.   }
  171. #endif
  172.  
  173. #ifndef _GLIBCXX_HAVE_MODFL
  174.   long double
  175.   modfl(long double x, long double *iptr)
  176.   {
  177.     double result, temp;
  178.  
  179.     result = modf((double) x, &temp);
  180.     *iptr = temp;
  181.     return result;
  182.   }
  183. #endif
  184.  
  185. #ifndef _GLIBCXX_HAVE_POWL
  186.   long double
  187.   powl(long double x, long double y)
  188.   {
  189.     return pow((double) x, (double) y);
  190.   }
  191. #endif
  192.  
  193. #ifndef _GLIBCXX_HAVE_SINL
  194.   long double
  195.   sinl(long double x)
  196.   {
  197.     return sin((double) x);
  198.   }
  199. #endif
  200.  
  201. #ifndef _GLIBCXX_HAVE_SINHL
  202.   long double
  203.   sinhl(long double x)
  204.   {
  205.     return sinh((double) x);
  206.   }
  207. #endif
  208.  
  209. #ifndef _GLIBCXX_HAVE_TANL
  210.   long double
  211.   tanl(long double x)
  212.   {
  213.     return tan((double) x);
  214.   }
  215. #endif
  216.  
  217. #ifndef _GLIBCXX_HAVE_TANHL
  218.   long double
  219.   tanhl(long double x)
  220.   {
  221.     return tanh((double) x);
  222.   }
  223. #endif
  224. } // extern "C"
  225.