1/* 2 * ==================================================== 3 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 4 * 5 * Developed at SunPro, a Sun Microsystems, Inc. business. 6 * Permission to use, copy, modify, and distribute this 7 * software is freely granted, provided that this notice 8 * is preserved. 9 * ==================================================== 10 */ 11 12/* 13 * from: @(#)fdlibm.h 5.1 93/09/24
| 1/* 2 * ==================================================== 3 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 4 * 5 * Developed at SunPro, a Sun Microsystems, Inc. business. 6 * Permission to use, copy, modify, and distribute this 7 * software is freely granted, provided that this notice 8 * is preserved. 9 * ==================================================== 10 */ 11 12/* 13 * from: @(#)fdlibm.h 5.1 93/09/24
|
53 54typedef __double_t double_t; 55typedef __float_t float_t; 56 57/* 58 * XOPEN/SVID 59 */ 60#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 61#define M_E 2.7182818284590452354 /* e */ 62#define M_LOG2E 1.4426950408889634074 /* log 2e */ 63#define M_LOG10E 0.43429448190325182765 /* log 10e */ 64#define M_LN2 0.69314718055994530942 /* log e2 */ 65#define M_LN10 2.30258509299404568402 /* log e10 */ 66#define M_PI 3.14159265358979323846 /* pi */ 67#define M_PI_2 1.57079632679489661923 /* pi/2 */ 68#define M_PI_4 0.78539816339744830962 /* pi/4 */ 69#define M_1_PI 0.31830988618379067154 /* 1/pi */ 70#define M_2_PI 0.63661977236758134308 /* 2/pi */ 71#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ 72#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ 73#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ 74 75#define MAXFLOAT ((float)3.40282346638528860e+38) 76extern int signgam; 77 78#if !defined(_XOPEN_SOURCE) 79enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix}; 80 81#define _LIB_VERSION_TYPE enum fdversion 82#define _LIB_VERSION _fdlib_version 83 84/* if global variable _LIB_VERSION is not desirable, one may 85 * change the following to be a constant by: 86 * #define _LIB_VERSION_TYPE const enum version 87 * In that case, after one initializes the value _LIB_VERSION (see 88 * s_lib_version.c) during compile time, it cannot be modified 89 * in the middle of a program 90 */ 91extern _LIB_VERSION_TYPE _LIB_VERSION; 92 93#define _IEEE_ fdlibm_ieee 94#define _SVID_ fdlibm_svid 95#define _XOPEN_ fdlibm_xopen 96#define _POSIX_ fdlibm_posix 97 98/* We have a problem when using C++ since `exception' is a reserved 99 name in C++. */ 100#ifndef __cplusplus 101struct exception { 102 int type; 103 char *name; 104 double arg1; 105 double arg2; 106 double retval; 107}; 108#endif 109 110#if 0 111/* Old value from 4.4BSD-Lite math.h; this is probably better. */ 112#define HUGE HUGE_VAL 113#else 114#define HUGE MAXFLOAT 115#endif 116 117/* 118 * set X_TLOSS = pi*2**52, which is possibly defined in <values.h> 119 * (one may replace the following line by "#include <values.h>") 120 */ 121 122#define X_TLOSS 1.41484755040568800000e+16 123 124#define DOMAIN 1 125#define SING 2 126#define OVERFLOW 3 127#define UNDERFLOW 4 128#define TLOSS 5 129#define PLOSS 6 130 131#endif /* !_XOPEN_SOURCE */ 132#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ 133 134#include <sys/cdefs.h> 135 136/* 137 * Most of these functions have the side effect of setting errno, so they 138 * are not declared as __pure2. (XXX: this point needs to be revisited, 139 * since C99 doesn't require the mistake of setting errno, and we mostly 140 * don't set it anyway. In C99, pragmas and functions for changing the 141 * rounding mode affect the purity of these functions.) 142 */ 143__BEGIN_DECLS 144/* 145 * ANSI/POSIX 146 */ 147int __fpclassifyd(double); 148int __fpclassifyf(float); 149int __fpclassifyl(long double);
| 54 55typedef __double_t double_t; 56typedef __float_t float_t; 57 58/* 59 * XOPEN/SVID 60 */ 61#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 62#define M_E 2.7182818284590452354 /* e */ 63#define M_LOG2E 1.4426950408889634074 /* log 2e */ 64#define M_LOG10E 0.43429448190325182765 /* log 10e */ 65#define M_LN2 0.69314718055994530942 /* log e2 */ 66#define M_LN10 2.30258509299404568402 /* log e10 */ 67#define M_PI 3.14159265358979323846 /* pi */ 68#define M_PI_2 1.57079632679489661923 /* pi/2 */ 69#define M_PI_4 0.78539816339744830962 /* pi/4 */ 70#define M_1_PI 0.31830988618379067154 /* 1/pi */ 71#define M_2_PI 0.63661977236758134308 /* 2/pi */ 72#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ 73#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ 74#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ 75 76#define MAXFLOAT ((float)3.40282346638528860e+38) 77extern int signgam; 78 79#if !defined(_XOPEN_SOURCE) 80enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix}; 81 82#define _LIB_VERSION_TYPE enum fdversion 83#define _LIB_VERSION _fdlib_version 84 85/* if global variable _LIB_VERSION is not desirable, one may 86 * change the following to be a constant by: 87 * #define _LIB_VERSION_TYPE const enum version 88 * In that case, after one initializes the value _LIB_VERSION (see 89 * s_lib_version.c) during compile time, it cannot be modified 90 * in the middle of a program 91 */ 92extern _LIB_VERSION_TYPE _LIB_VERSION; 93 94#define _IEEE_ fdlibm_ieee 95#define _SVID_ fdlibm_svid 96#define _XOPEN_ fdlibm_xopen 97#define _POSIX_ fdlibm_posix 98 99/* We have a problem when using C++ since `exception' is a reserved 100 name in C++. */ 101#ifndef __cplusplus 102struct exception { 103 int type; 104 char *name; 105 double arg1; 106 double arg2; 107 double retval; 108}; 109#endif 110 111#if 0 112/* Old value from 4.4BSD-Lite math.h; this is probably better. */ 113#define HUGE HUGE_VAL 114#else 115#define HUGE MAXFLOAT 116#endif 117 118/* 119 * set X_TLOSS = pi*2**52, which is possibly defined in <values.h> 120 * (one may replace the following line by "#include <values.h>") 121 */ 122 123#define X_TLOSS 1.41484755040568800000e+16 124 125#define DOMAIN 1 126#define SING 2 127#define OVERFLOW 3 128#define UNDERFLOW 4 129#define TLOSS 5 130#define PLOSS 6 131 132#endif /* !_XOPEN_SOURCE */ 133#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ 134 135#include <sys/cdefs.h> 136 137/* 138 * Most of these functions have the side effect of setting errno, so they 139 * are not declared as __pure2. (XXX: this point needs to be revisited, 140 * since C99 doesn't require the mistake of setting errno, and we mostly 141 * don't set it anyway. In C99, pragmas and functions for changing the 142 * rounding mode affect the purity of these functions.) 143 */ 144__BEGIN_DECLS 145/* 146 * ANSI/POSIX 147 */ 148int __fpclassifyd(double); 149int __fpclassifyf(float); 150int __fpclassifyl(long double);
|
150 151double acos(double); 152double asin(double); 153double atan(double); 154double atan2(double, double); 155double cos(double); 156double sin(double); 157double tan(double); 158 159double cosh(double); 160double sinh(double); 161double tanh(double); 162 163double exp(double); 164double frexp(double, int *); /* fundamentally !__pure2 */ 165double ldexp(double, int); 166double log(double); 167double log10(double); 168double modf(double, double *); /* fundamentally !__pure2 */ 169 170double pow(double, double); 171double sqrt(double); 172 173double ceil(double); 174double fabs(double); 175double floor(double); 176double fmod(double, double); 177 178/* 179 * These functions are not in C90 so they can be "right". The ones that 180 * never set errno in lib/msun are declared as __pure2. 181 */ 182#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 183double erf(double); 184double erfc(double) __pure2; 185int finite(double) __pure2; 186double gamma(double); 187double hypot(double, double); 188int isinf(double) __pure2; 189int isnan(double) __pure2; 190double j0(double); 191double j1(double); 192double jn(int, double); 193double lgamma(double); 194double y0(double); 195double y1(double); 196double yn(int, double); 197 198#if !defined(_XOPEN_SOURCE) 199double acosh(double); 200double asinh(double); 201double atanh(double); 202double cbrt(double) __pure2; 203double logb(double) __pure2; 204double nextafter(double, double); 205double remainder(double, double); 206double scalb(double, double); 207double tgamma(double); 208 209#ifndef __cplusplus 210int matherr(struct exception *); 211#endif 212 213/* 214 * IEEE Test Vector 215 */ 216double significand(double); 217 218/* 219 * Functions callable from C, intended to support IEEE arithmetic. 220 */ 221double copysign(double, double) __pure2; 222int ilogb(double); 223double rint(double) __pure2; 224double scalbn(double, int); 225 226/* 227 * BSD math library entry points 228 */ 229double drem(double, double); 230double expm1(double) __pure2; 231double log1p(double) __pure2; 232 233/* 234 * Reentrant version of gamma & lgamma; passes signgam back by reference 235 * as the second argument; user must allocate space for signgam. 236 */ 237#ifdef _REENTRANT 238double gamma_r(double, int *); 239double lgamma_r(double, int *); 240#endif /* _REENTRANT */ 241 242/* float versions of ANSI/POSIX functions */ 243float acosf(float); 244float asinf(float); 245float atanf(float); 246float atan2f(float, float); 247float cosf(float); 248float sinf(float); 249float tanf(float); 250 251float coshf(float); 252float sinhf(float); 253float tanhf(float); 254 255float expf(float); 256float frexpf(float, int *); /* fundamentally !__pure2 */ 257float ldexpf(float, int); 258float logf(float); 259float log10f(float); 260float modff(float, float *); /* fundamentally !__pure2 */ 261 262float powf(float, float); 263float sqrtf(float); 264 265float ceilf(float); 266float fabsf(float); 267float floorf(float); 268float fmodf(float, float); 269 270float erff(float); 271float erfcf(float) __pure2; 272int finitef(float) __pure2; 273float gammaf(float); 274float hypotf(float, float) __pure2; 275int isnanf(float) __pure2; 276float j0f(float); 277float j1f(float); 278float jnf(int, float); 279float lgammaf(float); 280float y0f(float); 281float y1f(float); 282float ynf(int, float); 283 284float acoshf(float); 285float asinhf(float); 286float atanhf(float); 287float cbrtf(float) __pure2; 288float logbf(float) __pure2; 289float nextafterf(float, float); 290float remainderf(float, float); 291float scalbf(float, float); 292 293/* 294 * float version of IEEE Test Vector 295 */ 296float significandf(float); 297 298/* 299 * Float versions of functions callable from C, intended to support 300 * IEEE arithmetic. 301 */ 302float copysignf(float, float) __pure2; 303int ilogbf(float); 304float rintf(float); 305float scalbnf(float, int); 306 307/* 308 * float versions of BSD math library entry points 309 */ 310float dremf(float, float); 311float expm1f(float) __pure2; 312float log1pf(float) __pure2; 313 314/* 315 * Float versions of reentrant version of gamma & lgamma; passes 316 * signgam back by reference as the second argument; user must 317 * allocate space for signgam. 318 */ 319#ifdef _REENTRANT 320float gammaf_r(float, int *); 321float lgammaf_r(float, int *); 322#endif /* _REENTRANT */ 323 324#endif /* !_XOPEN_SOURCE */ 325#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ 326__END_DECLS 327 328#endif /* !_MATH_H_ */
| 152 153double acos(double); 154double asin(double); 155double atan(double); 156double atan2(double, double); 157double cos(double); 158double sin(double); 159double tan(double); 160 161double cosh(double); 162double sinh(double); 163double tanh(double); 164 165double exp(double); 166double frexp(double, int *); /* fundamentally !__pure2 */ 167double ldexp(double, int); 168double log(double); 169double log10(double); 170double modf(double, double *); /* fundamentally !__pure2 */ 171 172double pow(double, double); 173double sqrt(double); 174 175double ceil(double); 176double fabs(double); 177double floor(double); 178double fmod(double, double); 179 180/* 181 * These functions are not in C90 so they can be "right". The ones that 182 * never set errno in lib/msun are declared as __pure2. 183 */ 184#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 185double erf(double); 186double erfc(double) __pure2; 187int finite(double) __pure2; 188double gamma(double); 189double hypot(double, double); 190int isinf(double) __pure2; 191int isnan(double) __pure2; 192double j0(double); 193double j1(double); 194double jn(int, double); 195double lgamma(double); 196double y0(double); 197double y1(double); 198double yn(int, double); 199 200#if !defined(_XOPEN_SOURCE) 201double acosh(double); 202double asinh(double); 203double atanh(double); 204double cbrt(double) __pure2; 205double logb(double) __pure2; 206double nextafter(double, double); 207double remainder(double, double); 208double scalb(double, double); 209double tgamma(double); 210 211#ifndef __cplusplus 212int matherr(struct exception *); 213#endif 214 215/* 216 * IEEE Test Vector 217 */ 218double significand(double); 219 220/* 221 * Functions callable from C, intended to support IEEE arithmetic. 222 */ 223double copysign(double, double) __pure2; 224int ilogb(double); 225double rint(double) __pure2; 226double scalbn(double, int); 227 228/* 229 * BSD math library entry points 230 */ 231double drem(double, double); 232double expm1(double) __pure2; 233double log1p(double) __pure2; 234 235/* 236 * Reentrant version of gamma & lgamma; passes signgam back by reference 237 * as the second argument; user must allocate space for signgam. 238 */ 239#ifdef _REENTRANT 240double gamma_r(double, int *); 241double lgamma_r(double, int *); 242#endif /* _REENTRANT */ 243 244/* float versions of ANSI/POSIX functions */ 245float acosf(float); 246float asinf(float); 247float atanf(float); 248float atan2f(float, float); 249float cosf(float); 250float sinf(float); 251float tanf(float); 252 253float coshf(float); 254float sinhf(float); 255float tanhf(float); 256 257float expf(float); 258float frexpf(float, int *); /* fundamentally !__pure2 */ 259float ldexpf(float, int); 260float logf(float); 261float log10f(float); 262float modff(float, float *); /* fundamentally !__pure2 */ 263 264float powf(float, float); 265float sqrtf(float); 266 267float ceilf(float); 268float fabsf(float); 269float floorf(float); 270float fmodf(float, float); 271 272float erff(float); 273float erfcf(float) __pure2; 274int finitef(float) __pure2; 275float gammaf(float); 276float hypotf(float, float) __pure2; 277int isnanf(float) __pure2; 278float j0f(float); 279float j1f(float); 280float jnf(int, float); 281float lgammaf(float); 282float y0f(float); 283float y1f(float); 284float ynf(int, float); 285 286float acoshf(float); 287float asinhf(float); 288float atanhf(float); 289float cbrtf(float) __pure2; 290float logbf(float) __pure2; 291float nextafterf(float, float); 292float remainderf(float, float); 293float scalbf(float, float); 294 295/* 296 * float version of IEEE Test Vector 297 */ 298float significandf(float); 299 300/* 301 * Float versions of functions callable from C, intended to support 302 * IEEE arithmetic. 303 */ 304float copysignf(float, float) __pure2; 305int ilogbf(float); 306float rintf(float); 307float scalbnf(float, int); 308 309/* 310 * float versions of BSD math library entry points 311 */ 312float dremf(float, float); 313float expm1f(float) __pure2; 314float log1pf(float) __pure2; 315 316/* 317 * Float versions of reentrant version of gamma & lgamma; passes 318 * signgam back by reference as the second argument; user must 319 * allocate space for signgam. 320 */ 321#ifdef _REENTRANT 322float gammaf_r(float, int *); 323float lgammaf_r(float, int *); 324#endif /* _REENTRANT */ 325 326#endif /* !_XOPEN_SOURCE */ 327#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ 328__END_DECLS 329 330#endif /* !_MATH_H_ */
|