1 // Stub definitions for long double math.
3 // Copyright (C) 2001-2014 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 3, 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 // 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.
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/>.
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.
33 #ifndef _GLIBCXX_HAVE_FABSL
37 return fabs((double) x
);
41 #ifndef _GLIBCXX_HAVE_ACOSL
45 return acos((double) x
);
49 #ifndef _GLIBCXX_HAVE_ASINL
53 return asin((double) x
);
57 #ifndef _GLIBCXX_HAVE_ATANL
61 return atan ((double) x
);
65 #ifndef _GLIBCXX_HAVE_ATAN2L
67 atan2l(long double x
, long double y
)
69 return atan2((double) x
, (double) y
);
73 #ifndef _GLIBCXX_HAVE_CEILL
77 return ceil((double) x
);
81 #ifndef _GLIBCXX_HAVE_COSL
85 return cos((double) x
);
89 #ifndef _GLIBCXX_HAVE_COSHL
93 return cosh((double) x
);
97 #ifndef _GLIBCXX_HAVE_EXPL
101 return exp((double) x
);
105 #ifndef _GLIBCXX_HAVE_FLOORL
107 floorl(long double x
)
109 return floor((double) x
);
113 #ifndef _GLIBCXX_HAVE_FMODL
115 fmodl(long double x
, long double y
)
117 return fmod((double) x
, (double) y
);
121 #ifndef _GLIBCXX_HAVE_FREXPL
123 frexpl(long double x
, int *exp
)
125 return frexp((double) x
, exp
);
129 #ifndef _GLIBCXX_HAVE_SQRTL
133 return sqrt((double) x
);
137 #ifndef _GLIBCXX_HAVE_HYPOTL
139 hypotl(long double x
, long double y
)
141 long double s
= fabsl(x
) + fabsl(y
);
145 return s
* sqrtl(x
* x
+ y
* y
);
149 #ifndef _GLIBCXX_HAVE_LDEXPL
151 ldexpl(long double x
, int exp
)
153 return ldexp((double) x
, exp
);
157 #ifndef _GLIBCXX_HAVE_LOGL
161 return log((double) x
);
165 #ifndef _GLIBCXX_HAVE_LOG10L
167 log10l(long double x
)
169 return log10((double) x
);
173 #ifndef _GLIBCXX_HAVE_MODFL
175 modfl(long double x
, long double *iptr
)
179 result
= modf((double) x
, &temp
);
185 #ifndef _GLIBCXX_HAVE_POWL
187 powl(long double x
, long double y
)
189 return pow((double) x
, (double) y
);
193 #ifndef _GLIBCXX_HAVE_SINL
197 return sin((double) x
);
201 #ifndef _GLIBCXX_HAVE_SINHL
205 return sinh((double) x
);
209 #ifndef _GLIBCXX_HAVE_TANL
213 return tan((double) x
);
217 #ifndef _GLIBCXX_HAVE_TANHL
221 return tanh((double) x
);