1 // Stub definitions for long double math.
3 // Copyright (C) 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
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 2, or (at your option)
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.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING. If not, write to the Free
18 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 // As a special exception, you may use this file as part of a free software
22 // library without restriction. Specifically, if other files instantiate
23 // templates or use macros or inline functions from this file, or you compile
24 // this file and link it with other files to produce an executable, this
25 // file does not by itself cause the resulting executable to be covered by
26 // the GNU General Public License. This exception does not however
27 // invalidate any other reasons why the executable file might be covered by
28 // the GNU General Public License.
32 // For targets which do not have support for long double versions,
33 // we use the following crude approximations. We keep saying that we'll do
34 // better later, but never do.
38 #ifndef _GLIBCXX_HAVE_FABSL
42 return fabs((double) x);
46 #ifndef _GLIBCXX_HAVE_ACOSL
50 return acos((double) x);
54 #ifndef _GLIBCXX_HAVE_ASINL
58 return asin((double) x);
62 #ifndef _GLIBCXX_HAVE_ATANL
66 return atan ((double) x);
70 #ifndef _GLIBCXX_HAVE_ATAN2L
72 atan2l(long double x, long double y)
74 return atan2((double) x, (double) y);
78 #ifndef _GLIBCXX_HAVE_COSL
82 return cos((double) x);
86 #ifndef _GLIBCXX_HAVE_COSHL
90 return cosh((double) x);
94 #ifndef _GLIBCXX_HAVE_EXPL
98 return exp((double) x);
102 #ifndef _GLIBCXX_HAVE_FLOORL
104 floorl(long double x)
106 return floor((double) x);
110 #ifndef _GLIBCXX_HAVE_FMODL
112 fmodl(long double x, long double y)
114 return fmod((double) x, (double) y);
118 #ifndef _GLIBCXX_HAVE_FREXPL
120 frexpl(long double x, int *exp)
122 return frexp((double) x, exp);
126 #ifndef _GLIBCXX_HAVE_SQRTL
130 return sqrt((double) x);
134 #ifndef _GLIBCXX_HAVE_HYPOTL
136 hypotl(long double x, long double y)
138 long double s = fabsl(x) + fabsl(y);
142 return s * sqrtl(x * x + y * y);
146 #ifndef _GLIBCXX_HAVE_LDEXPL
148 ldexpl(long double x, int exp)
150 return ldexp((double) x, exp);
154 #ifndef _GLIBCXX_HAVE_LOGL
158 return log((double) x);
162 #ifndef _GLIBCXX_HAVE_LOG10L
164 log10l(long double x)
166 return log10((double) x);
170 #ifndef _GLIBCXX_HAVE_MODFL
172 modfl(long double x, long double *iptr)
176 result = modf((double) x, &temp);
182 #ifndef _GLIBCXX_HAVE_POWL
184 powl(long double x, long double y)
186 return pow((double) x, (double) y);
190 #ifndef _GLIBCXX_HAVE_SINL
194 return sin((double) x);
198 #ifndef _GLIBCXX_HAVE_SINHL
202 return sinh((double) x);
206 #ifndef _GLIBCXX_HAVE_TANL
210 return tan((double) x);
214 #ifndef _GLIBCXX_HAVE_TANHL
218 return tanh((double) x);