/*
 * Copyright (c) 1999 
 * Boris Fomitchev
 *
 * This material is provided "as is", with absolutely no warranty expressed
 * or implied. Any use is at your own risk.
 *
 * Permission to use or copy this software for any purpose is hereby granted 
 * without fee, provided the above notices are retained on all copies.
 * Permission to modify the code and to distribute modified code is granted,
 * provided the above notices are retained, and a notice that the code was
 * modified is included with the above copyright notice.
 *
 */

#ifndef _STLP_CMATH
#define _STLP_CMATH

#include <cstdlib>

#ifndef _STLP_OUTERMOST_HEADER_ID
#  define _STLP_OUTERMOST_HEADER_ID  0x110
#  include <stl/_prolog.h>
#endif

#if defined (_STLP_USE_NEW_C_HEADERS)
#  if defined (_STLP_HAS_NO_NAMESPACES) && ! defined (exception)
#    define exception __math_exception
#  endif
#  include _STLP_NATIVE_CPP_C_HEADER(cmath)
#  if defined (_STLP_HAS_NO_NAMESPACES)
#    undef exception
#  endif
#else
#  include <math.h>
#endif

#if (defined (__SUNPRO_CC) && (__SUNPRO_CC > 0x500)) || \
     !(defined (__IBMCPP__) && (__IBMCPP__ >= 500) || !(defined(__HP_aCC) && (__HP_aCC >= 30000) ))
#  ifndef _STLP_HAS_NO_NAMESPACES
namespace std {
#  endif
  extern "C" double hypot(double x, double y);
#  ifndef _STLP_HAS_NO_NAMESPACES
}
#  endif

#endif

#if defined(__sun) && defined(__GNUC__) 
extern "C" {
float __cosf(float v);
float __sinf(float v);
float __atan2f(float, float);
float __coshf(float v);
float __sinhf(float v);
float __sqrtf(float v);
float __expf(float v);
float __logf(float v);
float __log10f(float v);

long double __cosl(long double v);
long double __sinl(long double v);
long double __atan2l(long double, long double);
long double __coshl(long double v);
long double __sinhl(long double v);
long double __sqrtl(long double v);
long double __expl(long double v);
long double __logl(long double v);
long double __log10l(long double v);

}

extern "C" {
inline float cosf(float v) { return __cosf(v); }
inline float sinf(float v) { return __sinf(v); }
inline float atan2f(float v1, float v2) { return __atan2f(v1,v2); }
inline float coshf(float v) { return __coshf(v); }
inline float sinhf(float v) { return __sinhf(v); }
inline float sqrtf(float v) { return __sqrtf(v); }
inline float expf(float v) { return __expf(v); }
inline float logf(float v) { return __logf(v); }
inline float log10f(float v) { return __log10f(v); }

inline long double cosl(long double v) { return __cosl(v); }
inline long double sinl(long double v) { return __sinl(v); }
inline long double atan2l(long double v1, long double v2) { return __atan2l(v1,v2); }
inline long double coshl(long double v) { return __coshl(v); }
inline long double sinhl(long double v) { return __sinhl(v); }
inline long double sqrtl(long double v) { return __sqrtl(v); }
inline long double expl(long double v) { return __expl(v); }
inline long double logl(long double v) { return __logl(v); }
inline long double log10l(long double v) { return __log10l(v); }

}
#endif // __sun && __GNUC__

//_STLP_BEGIN_NAMESPACE
//using ::abs;
//_STLP_END_NAMESPACE

#ifndef _STLP_CMATH_H_HEADER
#  include <stl/_cmath.h>
#endif

#if (_STLP_OUTERMOST_HEADER_ID ==  0x110 )
#  include <stl/_epilog.h>
#  undef _STLP_OUTERMOST_HEADER_ID
#endif

#endif /* _STLP_CMATH */

// Local Variables:
// mode:C++
// End:
