xref: /netbsd-src/external/gpl3/gcc/dist/libstdc++-v3/include/c/cmath (revision b1e838363e3c6fc78a55519254d99869742dd33c)
14fee23f9Smrg// -*- C++ -*- forwarding header.
24fee23f9Smrg
3*b1e83836Smrg// Copyright (C) 2000-2022 Free Software Foundation, Inc.
44fee23f9Smrg//
54fee23f9Smrg// This file is part of the GNU ISO C++ Library.  This library is free
64fee23f9Smrg// software; you can redistribute it and/or modify it under the
74fee23f9Smrg// terms of the GNU General Public License as published by the
84fee23f9Smrg// Free Software Foundation; either version 3, or (at your option)
94fee23f9Smrg// any later version.
104fee23f9Smrg
114fee23f9Smrg// This library is distributed in the hope that it will be useful,
124fee23f9Smrg// but WITHOUT ANY WARRANTY; without even the implied warranty of
134fee23f9Smrg// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
144fee23f9Smrg// GNU General Public License for more details.
154fee23f9Smrg
164fee23f9Smrg// Under Section 7 of GPL version 3, you are granted additional
174fee23f9Smrg// permissions described in the GCC Runtime Library Exception, version
184fee23f9Smrg// 3.1, as published by the Free Software Foundation.
194fee23f9Smrg
204fee23f9Smrg// You should have received a copy of the GNU General Public License and
214fee23f9Smrg// a copy of the GCC Runtime Library Exception along with this program;
224fee23f9Smrg// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
234fee23f9Smrg// <http://www.gnu.org/licenses/>.
244fee23f9Smrg
254fee23f9Smrg//
264fee23f9Smrg// ISO C++ 14882: 26.5  C library
274fee23f9Smrg//
284fee23f9Smrg
294fee23f9Smrg#ifndef _GLIBCXX_CMATH
304fee23f9Smrg#define _GLIBCXX_CMATH 1
314fee23f9Smrg
324fee23f9Smrg#pragma GCC system_header
334fee23f9Smrg
344fee23f9Smrg#include <bits/c++config.h>
354fee23f9Smrg
364fee23f9Smrg#include_next <math.h>
374fee23f9Smrg
384fee23f9Smrg// Get rid of those macros defined in <math.h> in lieu of real functions.
394fee23f9Smrg#undef abs
404fee23f9Smrg#undef div
414fee23f9Smrg#undef acos
424fee23f9Smrg#undef asin
434fee23f9Smrg#undef atan
444fee23f9Smrg#undef atan2
454fee23f9Smrg#undef ceil
464fee23f9Smrg#undef cos
474fee23f9Smrg#undef cosh
484fee23f9Smrg#undef exp
494fee23f9Smrg#undef fabs
504fee23f9Smrg#undef floor
514fee23f9Smrg#undef fmod
524fee23f9Smrg#undef frexp
534fee23f9Smrg#undef ldexp
544fee23f9Smrg#undef log
554fee23f9Smrg#undef log10
564fee23f9Smrg#undef modf
574fee23f9Smrg#undef pow
584fee23f9Smrg#undef sin
594fee23f9Smrg#undef sinh
604fee23f9Smrg#undef sqrt
614fee23f9Smrg#undef tan
624fee23f9Smrg#undef tanh
634fee23f9Smrg
644fee23f9Smrg#undef fpclassify
654fee23f9Smrg#undef isfinite
664fee23f9Smrg#undef isinf
674fee23f9Smrg#undef isnan
684fee23f9Smrg#undef isnormal
694fee23f9Smrg#undef signbit
704fee23f9Smrg#undef isgreater
714fee23f9Smrg#undef isgreaterequal
724fee23f9Smrg#undef isless
734fee23f9Smrg#undef islessequal
744fee23f9Smrg#undef islessgreater
754fee23f9Smrg#undef isunordered
764fee23f9Smrg
7748fb7bfaSmrgnamespace std _GLIBCXX_VISIBILITY(default)
784fee23f9Smrg{
794fee23f9Smrg  inline double
804fee23f9Smrg  abs(double __x)
814fee23f9Smrg  { return __builtin_fabs(__x); }
824fee23f9Smrg
834fee23f9Smrg  inline float
844fee23f9Smrg  abs(float __x)
854fee23f9Smrg  { return __builtin_fabsf(__x); }
864fee23f9Smrg
874fee23f9Smrg  inline long double
884fee23f9Smrg  abs(long double __x)
894fee23f9Smrg  { return __builtin_fabsl(__x); }
904fee23f9Smrg
914fee23f9Smrg#if _GLIBCXX_HAVE_MODFF
924fee23f9Smrg  inline float
934fee23f9Smrg  modf(float __x, float* __iptr) { return modff(__x, __iptr); }
944fee23f9Smrg#else
954fee23f9Smrg  inline float
964fee23f9Smrg  modf(float __x, float* __iptr)
974fee23f9Smrg  {
984fee23f9Smrg    double __tmp;
994fee23f9Smrg    double __res = modf(static_cast<double>(__x), &__tmp);
1004fee23f9Smrg    *__iptr = static_cast<float>(__tmp);
1014fee23f9Smrg    return __res;
1024fee23f9Smrg  }
1034fee23f9Smrg#endif
1044fee23f9Smrg
1054fee23f9Smrg#if _GLIBCXX_HAVE_MODFL
1064fee23f9Smrg  inline long double
1074fee23f9Smrg  modf(long double __x, long double* __iptr) { return modfl(__x, __iptr); }
1084fee23f9Smrg#else
1094fee23f9Smrg  inline long double
1104fee23f9Smrg  modf(long double __x, long double* __iptr)
1114fee23f9Smrg  {
1124fee23f9Smrg    double __tmp;
1134fee23f9Smrg    double __res = modf(static_cast<double>(__x), &__tmp);
1144fee23f9Smrg    * __iptr = static_cast<long double>(__tmp);
1154fee23f9Smrg    return __res;
1164fee23f9Smrg  }
1174fee23f9Smrg#endif
1184fee23f9Smrg}
1194fee23f9Smrg#endif
120