/* math.h for GNU C openVMS/Alpha Created by Klaus K"ampf (kkaempf@progis.de) */ #ifndef __MATH_LOADED #define __MATH_LOADED 1 #ifdef __cplusplus extern "C" { #endif #ifndef __IEEE_FLOAT # define __IEEE_FLOAT 0 #endif #ifndef __G_FLOAT # define __G_FLOAT 0 #endif #ifndef __D_FLOAT # define __D_FLOAT ((!__G_FLOAT) && (!__IEEE_FLOAT)) #endif #if ((!__G_FLOAT) && (!__IEEE_FLOAT) && (!__D_FLOAT)) #error "No float method defined" #endif #if __G_FLOAT # define HUGE_VAL 8.988465674311578540726371186585e+307 #elif __IEEE_FLOAT # ifdef _IEEE_FP # define HUGE_VAL 1.8e+308 # else # define HUGE_VAL 1.7976931348623158e+308 # endif #else #ifdef __ALPHA # define HUGE_VAL 1.70141183460469213e+38 #else # define HUGE_VAL 1.70141183460469229e+38 #endif #endif #undef ___fdecl # define ___fdecl(_func,_arglist,_FUNC) _func _arglist __asm("MATH$" #_FUNC) #if __IEEE_FLOAT # define ___sdecl(_func,_arglist,_FUNC) _func _arglist __asm("MATH$" #_FUNC "_S") # define ___ddecl(_func,_arglist,_FUNC) _func _arglist __asm("MATH$" #_FUNC "_T") #elif __G_FLOAT # define ___sdecl(_func,_arglist,_FUNC) _func _arglist __asm("MATH$" #_FUNC "_F") # define ___ddecl(_func,_arglist,_FUNC) _func _arglist __asm("MATH$" #_FUNC "_G") #else # error "No floating format defined" #endif /* * 4.5.2 Trigonometric Functions */ double ___ddecl (acos, (double __x), ACOS); double ___ddecl (asin, (double __x), ASIN); double ___ddecl (atan, (double __x), ATAN); double ___ddecl (atan2,(double __y, double __x), ATAN2); double ___ddecl (cos, (double __x), COS); double ___ddecl (sin, (double __x), SIN); double ___ddecl (tan, (double __x), TAN); #ifdef __ALPHA float ___sdecl (acosf,(float __x), ACOSF); float ___sdecl (asinf,(float __x), ASINF); float ___sdecl (atanf,(float __x), ATANF); float ___sdecl (atan2f,(float __y, float __x), ATAN2F); float ___sdecl (cosf, (float __x), COSF); float ___sdecl (sinf, (float __x), SINF); float ___sdecl (tanf, (float __x), TANF); long double acosl (long double __x); long double asinl (long double __x); long double atanl (long double __x); long double atan2l (long double __y, long double __x); long double cosl (long double __x); long double sinl (long double __x); long double tanl (long double __x); #endif #if __G_FLOAT double MTH$GCOS_R7 (double __x); double MTH$GSIN_R7 (double __x); #elif __IEEE_FLOAT double MTH$TCOS_R7 (double __x); double MTH$TSIN_R7 (double __x); #else double MTH$DCOS_R7 (double __x); double MTH$DSIN_R7 (double __x); #endif /* * 4.5.3 Hyperbolic Functions */ double ___ddecl (cosh, (double __x), COSH); double ___ddecl (sinh, (double __x), SINH); double ___ddecl (tanh, (double __x), TANH); #ifdef __ALPHA float ___sdecl (coshf, (float __x), COSHF); float ___sdecl (sinhf, (float __x), SINHF); float ___sdecl (tanhf, (float __x), TANHF); long double coshl (long double __x); long double sinhl (long double __x); long double tanhl (long double __x); #endif #define VAXC$TANH 1 /* * 4.5.4 Exponential and Logarithmic Functions */ #if __IEEE_FLOAT double log (double __x) __asm ("decc$tlog_2"); #elif __G_FLOAT double log (double __x) __asm ("decc$glog_2"); #endif double ___ddecl (exp, (double __x), EXP); double ___ddecl (frexp,(double __value, int *__exp), FREXP); double ___ddecl (ldexp,(double __x, int __exp), LDEXP); double ___ddecl (log10,(double __x), LOG10); double ___ddecl (modf, (double __value, double *__iptr), MODF); #ifdef __ALPHA #if __IEEE_FLOAT double log2 (double __x) __asm ("decc$slogf_2"); #elif __G_FLOAT double log2 (double __x) __asm ("decc$flogf_2"); #endif double expm1 (double __x); double log1p (double __x); double logb (double __x); double scalb (double __x, double __n); #if __IEEE_FLOAT float expf (float __x) __asm ("MATH$EXP_S"); float frexpf (float __value, int *__exp) __asm ("MATH$FREXP_S"); float ldexpf (float __x, int __exp) __asm ("MATH$LDEXP_S"); float log10f (float __x) __asm ("MATH$LOG10_S"); float modff (float __value, float *__iptr) __asm ("MATH$MODF_S"); #elif __G_FLOAT float expf (float __x) __asm ("MATH$EXP_F"); float frexpf (float __value, int *__exp) __asm ("MATH$FREXP_F"); float ldexpf (float __x, int __exp) __asm ("MATH$LDEXP_F"); float log10f (float __x) __asm ("MATH$LOG10_F"); float modff (float __value, float *__iptr) __asm ("MATH$MODF_F"); #endif float expm1f (float __x); float logf (float __x); float log2f (float __x); float log1pf (float __x); float logbf (float __x); float scalbf (float __x, float __n); long double expl (long double __x); long double expm1l (long double __x); long double frexpl (long double __value, int *__exp); long double ldexpl (long double __x, int __exp); long double logl (long double __x); long double log2l (long double __x); long double log1pl (long double __x); long double logbl (long double __x); long double log10l (long double __x); long double modfl (long double __value, long double *__iptr); long double scalbl (long double __x, long double __n); #endif /* * 4.5.5 Power Functions */ #if __IEEE_FLOAT double pow (double __x, double __y) __asm ("decc$tpow_2"); double sqrt (double __x) __asm ("MATH$SQRT_T"); #elif __G_FLOAT double pow (double __x, double __y) __asm ("decc$gpow_2"); double sqrt (double __x) __asm ("MATH$SQRT_G"); #endif #ifdef __ALPHA double cbrt (double __x); float cbrtf (float __x); #if __IEEE_FLOAT float powf (float __x, float __y) __asm ("decc$spowf_2"); float sqrtf (float __x) __asm ("MATH$SQRT_S"); #elif __G_FLOAT float powf (float __x, float __y) __asm ("decc$fpowf_2"); float sqrtf (float __x) __asm ("MATH$SQRT_F"); #endif long double cbrtl (long double __x); long double powl (long double __x, long double __y); long double sqrtl (long double __x); #endif #ifndef __HIDE_FORBIDDEN_NAMES typedef struct { double x, y; } cabs_t; double cabs (cabs_t __z); double hypot (double __x, double __y); #ifdef __ALPHA typedef struct { float x, y; } cabsf_t; typedef struct { long double x, y; } cabsl_t; float cabsf (cabsf_t __z); float hypotf (float __x, float __y); long double cabsl (cabsl_t __z); long double hypotl (long double __x, long double __y); #endif #endif /* __HIDE_FORBIDDEN_NAMES */ /* * 4.5.6 Nearest Integer, Absolute Value, and Remainder Functions */ double ___ddecl (ceil, (double __x), CEIL); double ___ddecl (fabs, (double __x), FABS); double ___ddecl (floor,(double __x), FLOOR); #if __IEEE_FLOAT double fmod (double __x, double __y) __asm ("decc$tfmod_2"); #elif __G_FLOAT double fmod (double __x, double __y) __asm ("decc$gfmod_2"); #endif #ifdef __ALPHA #if __IEEE_FLOAT float ceilf (float __x) __asm ("MATH$CEIL_S"); float fabsf (float __x) __asm ("MATH$FABS_S"); float floorf (float __x) __asm ("MATH$FLOOR_S"); float fmodf (float __x, float __y) __asm ("decc$sfmodf_2"); #elif __G_FLOAT float ceilf (float __x) __asm ("MATH$CEIL_F"); float fabsf (float __x) __asm ("MATH$FABS_F"); float floorf (float __x) __asm ("MATH$FLOOR_F"); float fmodf (float __x, float __y) __asm ("decc$ffmodf_2"); #endif long double ceill (long double __x); long double fabsl (long double __x); long double floorl (long double __x); long double fmodl (long double __x, long double __y); #endif #ifndef __HIDE_FORBIDDEN_NAMES #ifdef __ALPHA /* ** X/Open CAE Specification math functions. isnan() conflicts ** with isnan() macro in . */ double erf(double __x ); double erfc(double __x); #if !defined __FP_LOADED int isnan( double __x); #endif double j0(double __x); double j1(double __x); double jn(int __n, double __x); double lgamma(double __x); double y0(double __x); double y1(double __x); double yn(int __n , double __x); float erff(float __x ); float erfcf(float __x); int isnanf( float __x); float j0f(float __x); float j1f(float __x); float jnf(int __n, float __x); float lgammaf(float __x); float y0f(float __x); float y1f(float __x); float ynf(int __n , float __x); long double erfl(long double __x ); long double erfcl(long double __x); int isnanl( long double __x); long double j0l(long double __x); long double j1l(long double __x); long double jnl(int __n, long double __x); long double lgammal(long double __x); long double y0l(long double __x); long double y1l(long double __x); long double ynl(int __n , long double __x); /* ** Miscellaneous IEEE functions */ double copysign (double __x, double __y); int finite( double __x); int fp_class ( double __x); double nextafter(double __x, double __y); int unordered ( double __x, double __y); float copysignf (float __x, float __y); int finitef( float __x); int fp_classf ( float __x); float nextafterf(float __x, float __y); int unorderedf ( float __x, float __y); long double copysignl (long double __x, long double __y); int finitel( long double __x); int fp_classl ( long double __x); long double nextafterl(long double __x, long double __y); int unorderedl ( long double __x, long double __y); /* ** Inverse hyperbolic functions */ double acosh(double __x); double asinh(double __x); double atanh(double __x); long double acoshl(long double __x); long double asinhl(long double __x); long double atanhl(long double __x); float acoshf(float __x); float asinhf(float __x); float atanhf(float __x); /* ** Cotangent */ double cot( double __x ); double cotd( double __x ); float cotf( float __x ); float cotdf( float __x ); long double cotl( long double __x ); long double cotdl( long double __x ); /* ** Trigonometric functions in degrees */ double acosd (double __x); double asind (double __x); double atand (double __x); double atand2 (double __y, double __x); double cosd (double __x); double sind (double __x); double tand (double __x); float acosdf (float __x); float asindf (float __x); float atandf (float __x); float atand2f (float __y, float __x); float cosdf (float __x); float sindf (float __x); float tandf (float __x); long double acosdl (long double __x); long double asindl (long double __x); long double atandl (long double __x); long double atand2l (long double __y, long double __x); long double cosdl (long double __x); long double sindl (long double __x); long double tandl (long double __x); /* ** Nearest integer, rounded nearest integer, truncate to integer */ double nint( double __x ); double rint( double __x ); double trunc( double __x ); float nintf( float __x ); float rintf( float __x ); float truncf( float __x ); long double nintl( long double __x ); long double rintl( long double __x ); long double truncl( long double __x ); #endif #endif #ifdef __cplusplus } #endif #undef ___fdecl #undef ___sdecl #undef ___ddecl #endif /* __MATH_LOADED */