std_cmath.h revision 169691
1146515Sru// -*- C++ -*- forwarding header.
2114472Sru
393139Sru// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
4114472Sru//
5114472Sru// This file is part of the GNU ISO C++ Library.  This library is free
693139Sru// software; you can redistribute it and/or modify it under the
7114472Sru// terms of the GNU General Public License as published by the
8114472Sru// Free Software Foundation; either version 2, or (at your option)
9114472Sru// any later version.
1093139Sru
11114472Sru// This library is distributed in the hope that it will be useful,
12114472Sru// but WITHOUT ANY WARRANTY; without even the implied warranty of
1321495Sjmacd// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1421495Sjmacd// GNU General Public License for more details.
1521495Sjmacd
1621495Sjmacd// You should have received a copy of the GNU General Public License along
1721495Sjmacd// with this library; see the file COPYING.  If not, write to the Free
1821495Sjmacd// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
1921495Sjmacd// USA.
2021495Sjmacd
2121495Sjmacd// As a special exception, you may use this file as part of a free software
2221495Sjmacd// library without restriction.  Specifically, if other files instantiate
2342660Smarkm// templates or use macros or inline functions from this file, or you compile
2421495Sjmacd// this file and link it with other files to produce an executable, this
2521495Sjmacd// file does not by itself cause the resulting executable to be covered by
2621495Sjmacd// the GNU General Public License.  This exception does not however
2721495Sjmacd// invalidate any other reasons why the executable file might be covered by
2821495Sjmacd// the GNU General Public License.
2921495Sjmacd
3042660Smarkm//
3121495Sjmacd// ISO C++ 14882: 26.5  C library
3221495Sjmacd//
3321495Sjmacd
3421495Sjmacd#ifndef _GLIBCXX_CMATH
3521495Sjmacd#define _GLIBCXX_CMATH 1
3621495Sjmacd
3742660Smarkm#pragma GCC system_header
3821495Sjmacd
3942660Smarkm#include <bits/c++config.h>
4021495Sjmacd
4121495Sjmacd#include_next <math.h>
4221495Sjmacd
4321495Sjmacd// Get rid of those macros defined in <math.h> in lieu of real functions.
4421495Sjmacd#undef abs
4521495Sjmacd#undef div
4621495Sjmacd#undef acos
4742660Smarkm#undef asin
4821495Sjmacd#undef atan
4921495Sjmacd#undef atan2
5021495Sjmacd#undef ceil
5121495Sjmacd#undef cos
5221495Sjmacd#undef cosh
5321495Sjmacd#undef exp
5421495Sjmacd#undef fabs
5521495Sjmacd#undef floor
5621495Sjmacd#undef fmod
5721495Sjmacd#undef frexp
5821495Sjmacd#undef ldexp
5921495Sjmacd#undef log
6021495Sjmacd#undef log10
6121495Sjmacd#undef modf
6221495Sjmacd#undef pow
6321495Sjmacd#undef sin
6421495Sjmacd#undef sinh
6521495Sjmacd#undef sqrt
6621495Sjmacd#undef tan
6721495Sjmacd#undef tanh
6821495Sjmacd
6921495Sjmacd#undef fpclassify
7021495Sjmacd#undef isfinite
7121495Sjmacd#undef isinf
7221495Sjmacd#undef isnan
7321495Sjmacd#undef isnormal
7421495Sjmacd#undef signbit
7521495Sjmacd#undef isgreater
7621495Sjmacd#undef isgreaterequal
7721495Sjmacd#undef isless
7821495Sjmacd#undef islessequal
7921495Sjmacd#undef islessgreater
8021495Sjmacd#undef isunordered
8121495Sjmacd
8221495Sjmacdnamespace std
8321495Sjmacd{
8421495Sjmacd  inline double
8521495Sjmacd  abs(double __x)
8621495Sjmacd  { return __builtin_fabs(__x); }
8721495Sjmacd
8821495Sjmacd  inline float
8921495Sjmacd  abs(float __x)
9021495Sjmacd  { return __builtin_fabsf(__x); }
9121495Sjmacd
9221495Sjmacd  inline long double
9356160Sru  abs(long double __x)
9421495Sjmacd  { return __builtin_fabsl(__x); }
9556160Sru
9656160Sru#if _GLIBCXX_HAVE_MODFF
9721495Sjmacd  inline float
9821495Sjmacd  modf(float __x, float* __iptr) { return modff(__x, __iptr); }
9921495Sjmacd#else
10021495Sjmacd  inline float
10121495Sjmacd  modf(float __x, float* __iptr)
10221495Sjmacd  {
10321495Sjmacd    double __tmp;
10421495Sjmacd    double __res = modf(static_cast<double>(__x), &__tmp);
10521495Sjmacd    *__iptr = static_cast<float>(__tmp);
10642660Smarkm    return __res;
10721495Sjmacd  }
10821495Sjmacd#endif
109
110#if _GLIBCXX_HAVE_MODFL
111  inline long double
112  modf(long double __x, long double* __iptr) { return modfl(__x, __iptr); }
113#else
114  inline long double
115  modf(long double __x, long double* __iptr)
116  {
117    double __tmp;
118    double __res = modf(static_cast<double>(__x), &__tmp);
119    * __iptr = static_cast<long double>(__tmp);
120    return __res;
121  }
122#endif
123}
124#endif
125