280 lines
11 KiB
Plaintext
280 lines
11 KiB
Plaintext
|
/***************************************************************************
|
||
|
* FILE: math.h/cmath (Math functions)
|
||
|
*
|
||
|
* =========================================================================
|
||
|
*
|
||
|
* Open Watcom Project
|
||
|
*
|
||
|
* Copyright (c) 2002-2010 Open Watcom Contributors. All Rights Reserved.
|
||
|
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
|
||
|
*
|
||
|
* This file is automatically generated. Do not edit directly.
|
||
|
*
|
||
|
* =========================================================================
|
||
|
*
|
||
|
* Description: This header is part of the C/C++ standard library. It
|
||
|
* describes the math functions provided by those standards.
|
||
|
***************************************************************************/
|
||
|
#ifndef _CMATH_INCLUDED
|
||
|
#define _CMATH_INCLUDED
|
||
|
|
||
|
#ifndef _ENABLE_AUTODEPEND
|
||
|
#pragma read_only_file;
|
||
|
#endif
|
||
|
|
||
|
#ifndef __cplusplus
|
||
|
#error This header file requires C++
|
||
|
#endif
|
||
|
|
||
|
#ifndef _COMDEF_H_INCLUDED
|
||
|
#include <_comdef.h>
|
||
|
#endif
|
||
|
|
||
|
extern "C" {
|
||
|
|
||
|
#ifdef _M_IX86
|
||
|
#pragma pack( __push, 1 )
|
||
|
#else
|
||
|
#pragma pack( __push, 8 )
|
||
|
#endif
|
||
|
|
||
|
_WCRTLINK extern const double *__get_HugeValue_ptr( void );
|
||
|
#if defined(__FUNCTION_DATA_ACCESS)
|
||
|
#define _HugeValue (*__get_HugeValue_ptr())
|
||
|
#elif defined(__SW_BR) || defined(_RTDLL)
|
||
|
#define _HugeValue _HugeValue_br
|
||
|
#endif
|
||
|
_WCRTDATA extern const double _WCDATA _HugeValue;
|
||
|
#define HUGE_VAL _HugeValue
|
||
|
|
||
|
|
||
|
/* Internal library helper routines */
|
||
|
_WMRTLINK extern int _FSClass( float __x );
|
||
|
_WMRTLINK extern int _FDClass( double __x );
|
||
|
_WMRTLINK extern int _FLClass( long double __x );
|
||
|
_WMRTLINK extern int _FSSign( float __x );
|
||
|
_WMRTLINK extern int _FDSign( double __x );
|
||
|
_WMRTLINK extern int _FLSign( long double __x );
|
||
|
|
||
|
/* Floating-point classification macros */
|
||
|
#define FP_ZERO 0
|
||
|
#define FP_SUBNORMAL 1
|
||
|
#define FP_NORMAL 2
|
||
|
#define FP_NAN 3
|
||
|
#define FP_INFINITE 4
|
||
|
|
||
|
#define fpclassify(x) \
|
||
|
((sizeof(x) == sizeof(float)) ? _FSClass(x) : \
|
||
|
(sizeof(x) == sizeof(double)) ? _FDClass(x) : \
|
||
|
_FLClass(x))
|
||
|
|
||
|
#define isfinite(x) (fpclassify(x) <= FP_NORMAL)
|
||
|
#define isinf(x) (fpclassify(x) == FP_INFINITE)
|
||
|
#define isnan(x) (fpclassify(x) == FP_NAN)
|
||
|
#define isnormal(x) (fpclassify(x) == FP_NORMAL)
|
||
|
|
||
|
#define signbit(x) \
|
||
|
((sizeof(x) == sizeof(float)) ? _FSSign(x) : \
|
||
|
(sizeof(x) == sizeof(double)) ? _FDSign(x) : \
|
||
|
_FLSign(x))
|
||
|
|
||
|
/* Floating-point Infinity and NaN constants */
|
||
|
_WMRTDATA extern const float __f_infinity;
|
||
|
_WMRTDATA extern const float __f_posqnan;
|
||
|
|
||
|
#define INFINITY __f_infinity
|
||
|
#define NAN __f_posqnan
|
||
|
|
||
|
namespace std {
|
||
|
_WMRTLINK extern double ceil( double __x );
|
||
|
_WMRTLINK extern double floor( double __x );
|
||
|
#if defined(_M_IX86) && 0
|
||
|
#pragma aux ceil parm nomemory modify nomemory;
|
||
|
#pragma aux floor parm nomemory modify nomemory;
|
||
|
#endif
|
||
|
_WMRTLINK extern double frexp( double __value, int *__exp );
|
||
|
_WMRTLINK extern double ldexp( double __x, int __exp );
|
||
|
_WMRTLINK extern double modf( double __value, double *__iptr );
|
||
|
|
||
|
_WMIRTLINK extern double acos( double __x );
|
||
|
_WMIRTLINK extern double asin( double __x );
|
||
|
_WMIRTLINK extern double atan( double __x );
|
||
|
_WMIRTLINK extern double atan2( double __y, double __x );
|
||
|
_WMIRTLINK extern double cos( double __x );
|
||
|
_WMIRTLINK extern double cosh( double __x );
|
||
|
_WMIRTLINK extern double exp( double __x );
|
||
|
_WMIRTLINK extern double fabs( double __x );
|
||
|
_WMIRTLINK extern double fmod( double __x, double __y );
|
||
|
_WMIRTLINK extern double log( double __x );
|
||
|
_WMIRTLINK extern double log10( double __x );
|
||
|
_WMIRTLINK extern double pow( double __x, double __y );
|
||
|
_WMIRTLINK extern double sin( double __x );
|
||
|
_WMIRTLINK extern double sinh( double __x );
|
||
|
_WMIRTLINK extern double sqrt( double __x );
|
||
|
_WMIRTLINK extern double tan( double __x );
|
||
|
_WMIRTLINK extern double tanh( double __x );
|
||
|
} // namespace std
|
||
|
|
||
|
#if !defined(NO_EXT_KEYS) /* extensions enabled */
|
||
|
|
||
|
/* non-ANSI */
|
||
|
|
||
|
struct _complex {
|
||
|
double x;
|
||
|
double y;
|
||
|
};
|
||
|
|
||
|
namespace std {
|
||
|
_WMRTLINK extern double acosh( double __x );
|
||
|
_WMRTLINK extern double asinh( double __x );
|
||
|
_WMRTLINK extern double atanh( double __x );
|
||
|
_WMRTLINK extern double hypot( double __x, double __y );
|
||
|
_WMRTLINK extern double log2( double __x );
|
||
|
}
|
||
|
|
||
|
_WMRTLINK extern double cabs( struct _complex );
|
||
|
_WMRTLINK extern double j0( double __x );
|
||
|
_WMRTLINK extern double j1( double __x );
|
||
|
_WMRTLINK extern double jn( int __n, double __x );
|
||
|
_WMRTLINK extern double y0( double __x );
|
||
|
_WMRTLINK extern double y1( double __x );
|
||
|
_WMRTLINK extern double yn( int __n, double __x );
|
||
|
|
||
|
/* The following struct is used to record errors detected in the math library.
|
||
|
* matherr is called with a pointer to this struct for possible error recovery.
|
||
|
*/
|
||
|
|
||
|
struct _exception {
|
||
|
int type; /* type of error, see below */
|
||
|
char *name; /* name of math function */
|
||
|
double arg1; /* value of first argument to function */
|
||
|
double arg2; /* second argument (if indicated) */
|
||
|
double retval; /* default return value */
|
||
|
};
|
||
|
|
||
|
#define DOMAIN 1 /* argument domain error */
|
||
|
#define SING 2 /* argument singularity */
|
||
|
#define OVERFLOW 3 /* overflow range error */
|
||
|
#define UNDERFLOW 4 /* underflow range error */
|
||
|
#define TLOSS 5 /* total loss of significance */
|
||
|
#define PLOSS 6 /* partial loss of significance */
|
||
|
|
||
|
_WMRTLINK extern int matherr( struct _exception * );
|
||
|
_WMRTLINK extern double _matherr( struct _exception * );
|
||
|
_WMRTLINK extern void _set_matherr( int (*rtn)( struct _exception * ) );
|
||
|
|
||
|
_WCRTLINK extern int _dieeetomsbin( double *__x, double *__y );
|
||
|
_WCRTLINK extern int _dmsbintoieee( double *__x, double *__y );
|
||
|
_WCRTLINK extern int _fieeetomsbin( float *__x, float *__y );
|
||
|
_WCRTLINK extern int _fmsbintoieee( float *__x, float *__y );
|
||
|
|
||
|
#endif /* extensions enabled */
|
||
|
|
||
|
#if !defined(__NO_MATH_OPS) && defined(_M_IX86)
|
||
|
/*
|
||
|
Defining the __NO_MATH_OPS macro will stop the compiler from
|
||
|
recognizing the following functions as intrinsic operators.
|
||
|
*/
|
||
|
namespace std {
|
||
|
#pragma intrinsic(log,cos,sin,tan,sqrt,fabs,pow,atan2,fmod)
|
||
|
#pragma intrinsic(acos,asin,atan,cosh,exp,log10,sinh,tanh)
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
#pragma pack( __pop )
|
||
|
|
||
|
} /* extern "C" */
|
||
|
|
||
|
#endif
|
||
|
|
||
|
#ifndef _INCLUDED_FROM_MATH_H
|
||
|
#ifndef _CMATH_AUX_INCLUDED
|
||
|
#define _CMATH_AUX_INCLUDED
|
||
|
|
||
|
namespace std {
|
||
|
// double
|
||
|
inline double abs( double __x ) { return( fabs( __x ) ); }
|
||
|
inline double pow( double __x, int __y )
|
||
|
{ return( pow( __x, (double)__y ) ); }
|
||
|
|
||
|
// float
|
||
|
inline float abs ( float __x ) { return( abs ( (double)__x ) ); }
|
||
|
inline float acos ( float __x ) { return( acos ( (double)__x ) ); }
|
||
|
inline float asin ( float __x ) { return( asin ( (double)__x ) ); }
|
||
|
inline float atan ( float __x ) { return( atan ( (double)__x ) ); }
|
||
|
inline float atan2( float __x, float __y )
|
||
|
{ return( atan2( (double)__x, (double)__y ) ); }
|
||
|
inline float ceil ( float __x ) { return( ceil ( (double)__x ) ); }
|
||
|
inline float cos ( float __x ) { return( cos ( (double)__x ) ); }
|
||
|
inline float cosh ( float __x ) { return( cosh ( (double)__x ) ); }
|
||
|
inline float exp ( float __x ) { return( exp ( (double)__x ) ); }
|
||
|
inline float fabs ( float __x ) { return( fabs ( (double)__x ) ); }
|
||
|
inline float floor( float __x ) { return( floor( (double)__x ) ); }
|
||
|
inline float fmod ( float __x, float __y )
|
||
|
{ return( fmod( (double)__x, (double)__y ) ); }
|
||
|
inline float frexp( float __value, int *__exp )
|
||
|
{ return( frexp( (double)__value, __exp ) ); }
|
||
|
inline float ldexp( float __x, int __exp )
|
||
|
{ return( ldexp( (double)__x, __exp ) ); }
|
||
|
inline float log ( float __x ) { return( log ( (double)__x ) ); }
|
||
|
inline float log10( float __x ) { return( log10( (double)__x ) ); }
|
||
|
inline float modf ( float __value, float *__iptr )
|
||
|
{
|
||
|
float __result; double __i;
|
||
|
__result = modf( (double)__value, &__i );
|
||
|
*__iptr = __i;
|
||
|
return( __result );
|
||
|
}
|
||
|
inline float pow ( float __x, float __y )
|
||
|
{ return( pow ( (double)__x, (double)__y ) ); }
|
||
|
inline float pow ( float __x, int __y )
|
||
|
{ return( pow ( (double)__x, __y ) ); }
|
||
|
inline float sin ( float __x ) { return( sin ( (double)__x ) ); }
|
||
|
inline float sinh ( float __x ) { return( sinh ( (double)__x ) ); }
|
||
|
inline float sqrt ( float __x ) { return( sqrt ( (double)__x ) ); }
|
||
|
inline float tan ( float __x ) { return( tan ( (double)__x ) ); }
|
||
|
inline float tanh ( float __x ) { return( tanh ( (double)__x ) ); }
|
||
|
|
||
|
// long double
|
||
|
inline long double abs ( long double __x ) { return( abs ( (double)__x ) ); }
|
||
|
inline long double acos ( long double __x ) { return( acos ( (double)__x ) ); }
|
||
|
inline long double asin ( long double __x ) { return( asin ( (double)__x ) ); }
|
||
|
inline long double atan ( long double __x ) { return( atan ( (double)__x ) ); }
|
||
|
inline long double atan2( long double __x, long double __y )
|
||
|
{ return( atan2( (double)__x, (double)__y ) ); }
|
||
|
inline long double ceil ( long double __x ) { return( ceil ( (double)__x ) ); }
|
||
|
inline long double cos ( long double __x ) { return( cos ( (double)__x ) ); }
|
||
|
inline long double cosh ( long double __x ) { return( cosh ( (double)__x ) ); }
|
||
|
inline long double exp ( long double __x ) { return( exp ( (double)__x ) ); }
|
||
|
inline long double fabs ( long double __x ) { return( fabs ( (double)__x ) ); }
|
||
|
inline long double floor( long double __x ) { return( floor( (double)__x ) ); }
|
||
|
inline long double fmod ( long double __x, long double __y )
|
||
|
{ return( fmod( (double)__x, (double)__y ) ); }
|
||
|
inline long double frexp( long double __value, int *__exp )
|
||
|
{ return( frexp( (double)__value, __exp ) ); }
|
||
|
inline long double ldexp( long double __x, int __exp )
|
||
|
{ return( ldexp( (double)__x, __exp ) ); }
|
||
|
inline long double log ( long double __x ) { return( log ( (double)__x ) ); }
|
||
|
inline long double log10( long double __x ) { return( log10( (double)__x ) ); }
|
||
|
inline long double modf ( long double __value, long double *__iptr )
|
||
|
{
|
||
|
long double __result; double __i;
|
||
|
__result = modf( (double)__value, &__i );
|
||
|
*__iptr = __i;
|
||
|
return( __result );
|
||
|
}
|
||
|
inline long double pow ( long double __x, long double __y )
|
||
|
{ return( pow ( (double)__x, (double)__y ) ); }
|
||
|
inline long double pow ( long double __x, int __y )
|
||
|
{ return( pow ( (double)__x, __y ) ); }
|
||
|
inline long double sin ( long double __x ) { return( sin ( (double)__x ) ); }
|
||
|
inline long double sinh ( long double __x ) { return( sinh ( (double)__x ) ); }
|
||
|
inline long double sqrt ( long double __x ) { return( sqrt ( (double)__x ) ); }
|
||
|
inline long double tan ( long double __x ) { return( tan ( (double)__x ) ); }
|
||
|
inline long double tanh ( long double __x ) { return( tanh ( (double)__x ) ); }
|
||
|
} // namespace std
|
||
|
|
||
|
#endif
|
||
|
|
||
|
#endif
|