]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/Include/math.h
Fix a bug about the iSCSI DHCP dependency issue.
[mirror_edk2.git] / StdLib / Include / math.h
index 81a900e6717e5d49b16c86941f9df1bbebdec64b..3041120087ad188a3713c45ae031f52ed38ecb8b 100644 (file)
@@ -1,6 +1,15 @@
-/*  $NetBSD: math.h,v 1.44 2006/03/25 16:41:11 xtraeme Exp $  */\r
+/** @file\r
+  Floating-point Math functions and macros.\r
+\r
+  Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials are licensed and made available under\r
+  the terms and conditions of the BSD License that accompanies this distribution.\r
+  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-/*\r
  * ====================================================\r
  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\r
  *\r
  * software is freely granted, provided that this notice\r
  * is preserved.\r
  * ====================================================\r
- */\r
-\r
-/*\r
- * @(#)fdlibm.h 5.1 93/09/24\r
- */\r
 \r
+    NetBSD: math.h,v 1.44 2006/03/25 16:41:11 xtraeme Exp\r
+    dlibm.h 5.1 93/09/24\r
+**/\r
 #ifndef _MATH_H_\r
 #define _MATH_H_\r
 \r
 #include  <sys/EfiCdefs.h>\r
-#include <sys/featuretest.h>\r
+#include  <sys/featuretest.h>\r
 \r
+/** @{\r
+    @brief    These are forward references to unions and macros used internaly\r
+              by the implementation of the math functions and macros.\r
+**/\r
 union __float_u {\r
   unsigned char __dummy[sizeof(float)];\r
   float __val;\r
@@ -36,8 +47,7 @@ union __long_double_u {
   long double __val;\r
 };\r
 \r
-#include <machine/math.h>   /* may use __float_u, __double_u,\r
-             or __long_double_u */\r
+#include <machine/math.h>   /* may use __float_u, __double_u, or __long_double_u */\r
 \r
 #ifdef __HAVE_LONG_DOUBLE\r
 #define __fpmacro_unary_floating(__name, __arg0)      \\r
@@ -55,64 +65,290 @@ union __long_double_u {
   : __ ## __name ## d (__arg0))\r
 #endif /* __HAVE_LONG_DOUBLE */\r
 \r
-/*\r
- * ANSI/POSIX\r
+extern const union __double_u       __infinity;\r
+extern const union __float_u        __infinityf;\r
+extern const union __long_double_u  __infinityl;\r
+\r
+/* C99 7.12.3.1 int fpclassify(real-floating x) */\r
+#define fpclassify(__x) __fpmacro_unary_floating(fpclassify, __x)\r
+\r
+/* C99 7.12.3.3 int isinf(real-floating x) */\r
+#ifdef __isinf\r
+  #define isinf(__x)  __isinf(__x)\r
+#else\r
+  #define isinf(__x)  __fpmacro_unary_floating(isinf, __x)\r
+#endif\r
+\r
+/* C99 7.12.3.4 int isnan(real-floating x) */\r
+#ifdef __isnan\r
+  #define isnan(__x)  __isnan(__x)\r
+#else\r
+  #define isnan(__x)  __fpmacro_unary_floating(isnan, __x)\r
+#endif\r
+/*@)*/\r
+\r
+/*#############################################################\r
+ * ISO C95\r
  */\r
-/* 7.12#3 HUGE_VAL, HUGELF, HUGE_VALL */\r
-extern const union __double_u __infinity;\r
+\r
+/**@{\r
+    Double, float, and long double versions, respectively, of HUGE_VAL.\r
+*/\r
 #define HUGE_VAL  __infinity.__val\r
+#define HUGE_VALF __infinityf.__val\r
+#define HUGE_VALL __infinityl.__val\r
+/*@)*/\r
 \r
+__BEGIN_DECLS\r
 /*\r
- * ISO C99\r
+ * ANSI/POSIX\r
  */\r
-/* 7.12#3 HUGE_VAL, HUGELF, HUGE_VALL */\r
-extern const union __float_u __infinityf;\r
-#define HUGE_VALF __infinityf.__val\r
+/** Compute the principal value of the arc cosine of Arg.\r
 \r
-extern const union __long_double_u __infinityl;\r
-#define HUGE_VALL __infinityl.__val\r
+    @param[in]    Arg   The value to compute the arc cosine of.\r
 \r
-/* 7.12#4 INFINITY */\r
-#ifdef __INFINITY\r
-#define INFINITY  __INFINITY  /* float constant which overflows */\r
-#else\r
-#define INFINITY  HUGE_VALF /* positive infinity */\r
-#endif /* __INFINITY */\r
+    @return   The computed value of the arc cosine of Arg in the interval [0,pi] radians.\r
+              If Arg is not in the interval [-1,+1], errno is set to EDOM.\r
+**/\r
+double  acos(double Arg);\r
 \r
-/* 7.12#5 NAN: a quiet NaN, if supported */\r
-#ifdef __HAVE_NANF\r
-extern const union __float_u __nanf;\r
-#define NAN   __nanf.__val\r
-#endif /* __HAVE_NANF */\r
+/** Compute the principal value of the arc sine of Arg.\r
 \r
-/* 7.12#6 number classification macros */\r
-#define FP_INFINITE 0x00\r
-#define FP_NAN    0x01\r
-#define FP_NORMAL 0x02\r
-#define FP_SUBNORMAL  0x03\r
-#define FP_ZERO   0x04\r
-/* NetBSD extensions */\r
-#define _FP_LOMD  0x80    /* range for machine-specific classes */\r
-#define _FP_HIMD  0xff\r
+    @param[in]    Arg   The value to compute the arc sine of.\r
+\r
+    @return   The computed value of the arc sine of Arg in the interval [-pi/2,+pi/2] radians.\r
+              If Arg is not in the interval [-1,+1], errno is set to EDOM.\r
+**/\r
+double  asin(double Arg);\r
+\r
+/** Compute the principal value of the arc tangent of Arg.\r
+\r
+    @param[in]    Arg   The value to compute the arc tangent of.\r
+\r
+    @return   The computed value of the arc tangent of Arg in the interval [-pi/2,+pi/2] radians.\r
+**/\r
+double  atan(double Arg);\r
+\r
+/** Compute the value of the arc tangent of (Num / Denom).\r
+    The sign of both arguments is used to determine the quadrant of the return value.\r
+\r
+    @param[in]    Num   The numerator of the value to compute the arc tangent of.\r
+    @param[in]    Denom The denominator of the value to compute the arc tangent of.\r
+\r
+    @return   The computed value of the arc tangent of (Num / Denom) in the interval [-pi,+pi] radians.\r
+**/\r
+double  atan2(double Num, double Denom);\r
+\r
+/** Compute the value of the cosine of Arg, measured in radians.\r
+\r
+    @param[in]    Arg   The value to compute the cosine of.\r
+\r
+    @return   The computed value of the cosine of Arg.\r
+**/\r
+double  cos(double Arg);\r
+\r
+/** Compute the value of the sine of Arg.\r
+\r
+    @param[in]    Arg   The value to compute the sine of.\r
+\r
+    @return   The computed value of the sine of Arg.\r
+**/\r
+double  sin(double Arg);\r
+\r
+/** Compute the value of the tangent of Arg.\r
+\r
+    @param[in]    Arg   The value to compute the tangent of.\r
+\r
+    @return   The computed value of the tangent of Arg.\r
+**/\r
+double  tan(double Arg);\r
+\r
+\r
+/** Compute the value of the hyperbolic cosine of Arg.\r
+\r
+    @param[in]    Arg   The value to compute the hyperbolic cosine of.\r
+\r
+    @return   The computed value of the hyperbolic cosine of Arg.\r
+              If the magnitude of Arg is too large, errno is set to ERANGE.\r
+**/\r
+double  cosh(double Arg);\r
+\r
+/** Compute the value of the hyperbolic sine of Arg.\r
+\r
+    @param[in]    Arg   The value to compute the hyperbolic sine of.\r
+\r
+    @return   The computed value of the hyperbolic sine of Arg.\r
+              If the magnitude of Arg is too large, errno is set to ERANGE.\r
+**/\r
+double  sinh(double Arg);\r
+\r
+/** Compute the value of the hyperbolic tangent of Arg.\r
+\r
+    @param[in]    Arg   The value to compute the hyperbolic tangent of.\r
+\r
+    @return   The computed value of the hyperbolic tangent of Arg.\r
+**/\r
+double  tanh(double Arg);\r
+\r
+\r
+/** Compute the base-e exponential of Arg.\r
+\r
+    @param[in]    Arg   The value to compute the base-e exponential of.\r
+\r
+    @return   The computed value of e**Arg.\r
+              If the magnitude of Arg is too large, errno is set to ERANGE.\r
+**/\r
+double  exp(double Arg);\r
+\r
+/** Break a floating-point number into a normalized fraction and an integral power of 2.\r
+\r
+    @param[in]    Value   The floating-point value to be broken down.\r
+    @param[out]   Exp     A pointer to an integer object to receive the integral power of 2 exponent.\r
+\r
+    @return   The frexp function returns a value R, such that Value == R**Exp.\r
+              If Value is zero, both parts of the result are zero.\r
+**/\r
+double  frexp(double Value, int *Exp);\r
+\r
+/** Multiply a floating-point number, Value, by an integral power of 2, Exp.\r
+\r
+    @param[in]    Value   The floating-point value to be multiplied.\r
+    @param[out]   Exp     The integral power of 2 to multiply Value by.\r
+\r
+    @return   The ldexp function returns a value R, such that R = Value x 2**Exp.\r
+              If a range error occurs, errno will be set to ERANGE.\r
+**/\r
+double  ldexp(double Value, int Exp);\r
+\r
+/** Compute the natural logarithm of Arg.\r
+\r
+    @param[in]    Arg   The value to compute the natural logarithm of.\r
+\r
+    @return   The log function returns log base-e of Arg. If Arg is negative, errno is set to EDOM.\r
+              Otherwise, errno will be set to ERANGE if a range error occurs.\r
+**/\r
+double  log(double Arg);\r
+\r
+/** Compute the common (base-10) logarithm of Arg.\r
+\r
+    @param[in]    Arg   The value to compute the common logarithm of.\r
+\r
+    @return   The log10 function returns log base-10 of Arg. If Arg is negative, errno is set to EDOM.\r
+              Otherwise, errno will be set to ERANGE if Arg is 0.\r
+**/\r
+double  log10(double Arg);\r
+\r
+/** Compute the base-2 logarithm of Arg.\r
+\r
+    @param[in]    Arg   The value to compute the base-2 logarithm of.\r
+\r
+    @return   The log function returns log base-2 of Arg. If Arg is negative, errno is set to EDOM.\r
+              Otherwise, errno will be set to ERANGE if Arg is 0.\r
+**/\r
+double  log2(double Arg);\r
+\r
+/** Break Value into integral and fractional parts, each of which has the same type and sign\r
+    as Value.  Store the integral part in the object pointed to by Integ and return the\r
+    fractional part.\r
+\r
+    @param[in]    Value   The value to compute the arc cosine of.\r
+    @param[out]   Integ   Pointer to where the integral component is to be stored.\r
+\r
+    @return   The fractional part of Value is returned directly while the integral part is\r
+              returned in the location pointed to by Integ.\r
+**/\r
+double  modf(double Value, double *Integ);\r
+\r
+/** Compute Value raised to the power Exp.\r
+\r
+    @param[in]    Value   The value to be raised.\r
+    @param[in]    Exp     The power Value is to be raised to.\r
+\r
+    @return   The pow function returns Value**Exp.  If an error occurs, errno will be set as follows:\r
+                - EDOM: Value is finite and negative and Exp is finite and not an integer.\r
+                - EDOM: Both Value and Exp are zero.\r
+                - EDOM: Value is zero and Exp is less than zero.\r
+**/\r
+double  pow(double Value, double Exp);\r
+\r
+/** Compute the non-negative square root of Arg.\r
+\r
+    @param[in]    Arg   The value to compute the square root of.\r
+\r
+    @return   The square root of Arg.  If Arg is less than zero, errno is set to EDOM.\r
+**/\r
+double  sqrt(double Arg);\r
+\r
+\r
+/** Compute the smallest integer value not less than Arg.\r
+\r
+    @param[in]    Arg   The value to compute the ceiling of.\r
+\r
+    @return   The ceiling of Arg expressed as a floating-point number.\r
+**/\r
+double  ceil(double Arg);\r
+\r
+/** Compute the absolute value of Arg.\r
+\r
+    @param[in]    Arg   The value to compute the absolute value of.\r
+\r
+    @return   The absolute value of Arg.\r
+**/\r
+double  fabs(double Arg);\r
+\r
+/** Compute the largest integer value not greater than Arg.\r
 \r
+    @param[in]    Arg   The value to compute the floor of.\r
+\r
+    @return   The largest integer value not greater than Arg, expressed as a floating-point number.\r
+**/\r
+double  floor(double);\r
+\r
+/** Compute the floating-point remainder of A1 / A2.\r
+\r
+    @param[in]    A1    The dividend.\r
+    @param[in]    A2    The divisor.\r
+\r
+    @return   The remainder of A1 / A2 with the same sign as A1.  If A2 is zero, the fmod function\r
+              returns 0.\r
+**/\r
+double  fmod(double A1, double A2);\r
+\r
+\r
+int finite(double);\r
+double  expm1(double);\r
+\r
+/**@{\r
+    C99, Posix, or NetBSD functions that are not part of the C95 specification.\r
+**/\r
 /*\r
- * XOPEN/SVID\r
+ * Functions callable from C, intended to support IEEE arithmetic.\r
  */\r
-#define M_E         2.7182818284590452354   /* e */\r
-#define M_LOG2E     1.4426950408889634074   /* log 2e */\r
-#define M_LOG10E    0.43429448190325182765  /* log 10e */\r
-#define M_LN2       0.69314718055994530942  /* log e2 */\r
-#define M_LN10      2.30258509299404568402  /* log e10 */\r
-#define M_PI        3.14159265358979323846  /* pi */\r
-#define M_PI_2      1.57079632679489661923  /* pi/2 */\r
-#define M_PI_4      0.78539816339744830962  /* pi/4 */\r
-#define M_1_PI      0.31830988618379067154  /* 1/pi */\r
-#define M_2_PI      0.63661977236758134308  /* 2/pi */\r
-#define M_2_SQRTPI  1.12837916709551257390  /* 2/sqrt(pi) */\r
-#define M_SQRT2     1.41421356237309504880  /* sqrt(2) */\r
-#define M_SQRT1_2   0.70710678118654752440  /* 1/sqrt(2) */\r
+double  copysign(double, double);\r
+double  scalbn(double, int);\r
 \r
-#define MAXFLOAT  ((float)3.40282346638528860e+38)\r
+/*\r
+ * Library implementation\r
+ */\r
+int __fpclassifyf(float);\r
+int __fpclassifyd(double);\r
+int __isinff(float);\r
+int __isinfd(double);\r
+int __isnanf(float);\r
+int __isnand(double);\r
+\r
+#ifdef __HAVE_LONG_DOUBLE\r
+  int __fpclassifyl(long double);\r
+  int __isinfl(long double);\r
+  int __isnanl(long double);\r
+#endif  /* __HAVE_LONG_DOUBLE */\r
+/*@}*/\r
+\r
+__END_DECLS\r
+\r
+/**@{\r
+    Extensions provided by NetBSD but not required by the C95 standard.\r
+**/\r
 extern int signgam;\r
 \r
 enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};\r
@@ -120,7 +356,7 @@ enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};
 #define _LIB_VERSION_TYPE enum fdversion\r
 #define _LIB_VERSION _fdlib_version\r
 \r
-/* if global variable _LIB_VERSION is not desirable, one may\r
+/** If global variable _LIB_VERSION is not desirable, one may\r
  * change the following to be a constant by:\r
  *  #define _LIB_VERSION_TYPE const enum version\r
  * In that case, after one initializes the value _LIB_VERSION (see\r
@@ -146,11 +382,7 @@ struct exception {
 \r
 #define HUGE    MAXFLOAT\r
 \r
-/*\r
- * set X_TLOSS = pi*2**52, which is possibly defined in <values.h>\r
- * (one may replace the following line by "#include <values.h>")\r
- */\r
-\r
+/** set X_TLOSS = pi*2**52 **/\r
 #define X_TLOSS   1.41484755040568800000e+16\r
 \r
 #define DOMAIN    1\r
@@ -159,295 +391,52 @@ struct exception {
 #define UNDERFLOW 4\r
 #define TLOSS     5\r
 #define PLOSS     6\r
+/*@}*/\r
 \r
-\r
-__BEGIN_DECLS\r
-/*\r
- * ANSI/POSIX\r
- */\r
-double  acos(double);\r
-double  asin(double);\r
-double  atan(double);\r
-double  atan2(double, double);\r
-double  cos(double);\r
-double  sin(double);\r
-double  tan(double);\r
-\r
-double  cosh(double);\r
-double  sinh(double);\r
-double  tanh(double);\r
-\r
-double  exp(double);\r
-double  frexp(double, int *);\r
-double  ldexp(double, int);\r
-double  log(double);\r
-double  log2(double);\r
-double  log10(double);\r
-double  modf(double, double *);\r
-\r
-double  pow(double, double);\r
-double  sqrt(double);\r
-\r
-double  ceil(double);\r
-double  fabs(double);\r
-double  floor(double);\r
-double  fmod(double, double);\r
-\r
-//#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)\r
-//double  erf(double);\r
-//double  erfc(double);\r
-//double  gamma(double);\r
-//double  hypot(double, double);\r
-int finite(double);\r
-//double  j0(double);\r
-//double  j1(double);\r
-//double  jn(int, double);\r
-//double  lgamma(double);\r
-//double  y0(double);\r
-//double  y1(double);\r
-//double  yn(int, double);\r
-\r
-//#if (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)\r
-//double  acosh(double);\r
-//double  asinh(double);\r
-//double  atanh(double);\r
-//double  cbrt(double);\r
-double  expm1(double);\r
-//int ilogb(double);\r
-//double  log1p(double);\r
-//double  logb(double);\r
-//double  nextafter(double, double);\r
-//double  remainder(double, double);\r
-//double  rint(double);\r
-//double  scalb(double, double);\r
-//#endif /* (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)*/\r
-//#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */\r
-\r
-/* 7.12.3.1 int fpclassify(real-floating x) */\r
-#define fpclassify(__x) __fpmacro_unary_floating(fpclassify, __x)\r
-\r
-#if 0\r
-/*\r
- * ISO C99\r
- */\r
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \\r
-    !defined(_XOPEN_SOURCE) || \\r
-    ((__STDC_VERSION__ - 0) >= 199901L) || \\r
-    ((_POSIX_C_SOURCE - 0) >= 200112L) || \\r
-    ((_XOPEN_SOURCE  - 0) >= 600) || \\r
-    defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)\r
-\r
-/* 7.12.3.2 int isfinite(real-floating x) */\r
-#define isfinite(__x) __fpmacro_unary_floating(isfinite, __x)\r
-\r
-/* 7.12.3.5 int isnormal(real-floating x) */\r
-#define isnormal(__x) (fpclassify(__x) == FP_NORMAL)\r
-\r
-/* 7.12.3.6 int signbit(real-floating x) */\r
-#define signbit(__x)  __fpmacro_unary_floating(signbit, __x)\r
-\r
-/* 7.12.4 trigonometric */\r
-\r
-float acosf(float);\r
-float asinf(float);\r
-float atanf(float);\r
-float atan2f(float, float);\r
-float cosf(float);\r
-float sinf(float);\r
-float tanf(float);\r
-\r
-/* 7.12.5 hyperbolic */\r
-\r
-float acoshf(float);\r
-float asinhf(float);\r
-float atanhf(float);\r
-float coshf(float);\r
-float sinhf(float);\r
-float tanhf(float);\r
-\r
-/* 7.12.6 exp / log */\r
-\r
-float expf(float);\r
-float expm1f(float);\r
-float frexpf(float, int *);\r
-int ilogbf(float);\r
-float ldexpf(float, int);\r
-float logf(float);\r
-float log2f(float);\r
-float log10f(float);\r
-float log1pf(float);\r
-float logbf(float);\r
-float modff(float, float *);\r
-float scalbnf(float, int);\r
-\r
-/* 7.12.7 power / absolute */\r
-\r
-float cbrtf(float);\r
-float fabsf(float);\r
-float hypotf(float, float);\r
-float powf(float, float);\r
-float sqrtf(float);\r
-\r
-/* 7.12.8 error / gamma */\r
-\r
-float erff(float);\r
-float erfcf(float);\r
-float lgammaf(float);\r
-\r
-/* 7.12.9 nearest integer */\r
-\r
-float ceilf(float);\r
-float floorf(float);\r
-float rintf(float);\r
-double  round(double);\r
-float roundf(float);\r
-double  trunc(double);\r
-float truncf(float);\r
-long int  lrint(double);\r
-long int  lrintf(float);\r
-/* LONGLONG */\r
-long long int llrint(double);\r
-/* LONGLONG */\r
-long long int llrintf(float);\r
-long int  lround(double);\r
-long int  lroundf(float);\r
-/* LONGLONG */\r
-long long int llround(double);\r
-/* LONGLONG */\r
-long long int llroundf(float);\r
-\r
-/* 7.12.10 remainder */\r
-\r
-float fmodf(float, float);\r
-float remainderf(float, float);\r
-\r
-/* 7.2.11 manipulation */\r
-\r
-float copysignf(float, float);\r
-double  nan(const char *);\r
-float nanf(const char *);\r
-long double nanl(const char *);\r
-float nextafterf(float, float);\r
-\r
-\r
-#endif /* !_ANSI_SOURCE && ... */\r
-\r
-#if defined(_NETBSD_SOURCE)\r
-#ifndef __cplusplus\r
-int matherr(struct exception *);\r
-#endif\r
-#endif /* _NETBSD_SOURCE */\r
-\r
-/*\r
- * IEEE Test Vector\r
- */\r
-double  significand(double);\r
-#endif  /* if 0 */\r
-\r
-/* 7.12.3.3 int isinf(real-floating x) */\r
-#ifdef __isinf\r
-#define isinf(__x)  __isinf(__x)\r
-#else\r
-#define isinf(__x)  __fpmacro_unary_floating(isinf, __x)\r
-#endif\r
-\r
-/* 7.12.3.4 int isnan(real-floating x) */\r
-#ifdef __isnan\r
-#define isnan(__x)  __isnan(__x)\r
+/* 7.12#4 INFINITY */\r
+#ifdef __INFINITY\r
+#define INFINITY  __INFINITY  /**< float constant which overflows */\r
 #else\r
-#define isnan(__x)  __fpmacro_unary_floating(isnan, __x)\r
-#endif\r
-\r
-/*\r
- * Functions callable from C, intended to support IEEE arithmetic.\r
- */\r
-double  copysign(double, double);\r
-double  scalbn(double, int);\r
-\r
-#if 0\r
-/*\r
- * BSD math library entry points\r
- */\r
-#ifndef __MATH_PRIVATE__\r
-double  cabs(/* struct complex { double r; double i; } */);\r
-#endif\r
-double  drem(double, double);\r
-\r
-\r
-#if defined(_NETBSD_SOURCE) || defined(_REENTRANT)\r
-/*\r
- * Reentrant version of gamma & lgamma; passes signgam back by reference\r
- * as the second argument; user must allocate space for signgam.\r
- */\r
-double  gamma_r(double, int *);\r
-double  lgamma_r(double, int *);\r
-#endif /* _NETBSD_SOURCE || _REENTRANT */\r
-\r
-\r
-#if defined(_NETBSD_SOURCE)\r
-\r
-/* float versions of ANSI/POSIX functions */\r
-\r
-float gammaf(float);\r
-int isinff(float);\r
-int isnanf(float);\r
-int finitef(float);\r
-float j0f(float);\r
-float j1f(float);\r
-float jnf(int, float);\r
-float y0f(float);\r
-float y1f(float);\r
-float ynf(int, float);\r
-\r
-float scalbf(float, float);\r
+#define INFINITY  HUGE_VALF   /**< positive infinity */\r
+#endif /* __INFINITY */\r
 \r
-/*\r
- * float version of IEEE Test Vector\r
- */\r
-float significandf(float);\r
+/* 7.12#5 NAN: a quiet NaN, if supported */\r
+#ifdef __HAVE_NANF\r
+extern const union __float_u __nanf;\r
+#define NAN   __nanf.__val\r
+#endif /* __HAVE_NANF */\r
 \r
-/*\r
- * float versions of BSD math library entry points\r
- */\r
-#ifndef __MATH_PRIVATE__\r
-float cabsf(/* struct complex { float r; float i; } */);\r
-#endif\r
-float dremf(float, float);\r
-#endif /* _NETBSD_SOURCE */\r
+/**@{\r
+    C99 7.12#6 Number classification macros represent mutually exclusive kinds of floating-point\r
+    values.\r
+**/\r
+#define FP_INFINITE   0x00\r
+#define FP_NAN        0x01\r
+#define FP_NORMAL     0x02\r
+#define FP_SUBNORMAL  0x03\r
+#define FP_ZERO       0x04\r
+/* NetBSD extensions */\r
+#define _FP_LOMD      0x80    /**< range for machine-specific classes */\r
+#define _FP_HIMD      0xff\r
+/*@)*/\r
 \r
-#if defined(_NETBSD_SOURCE) || defined(_REENTRANT)\r
-/*\r
- * Float versions of reentrant version of gamma & lgamma; passes\r
- * signgam back by reference as the second argument; user must\r
- * allocate space for signgam.\r
+/**@{\r
+ * Constants ala XOPEN/SVID.\r
  */\r
-float gammaf_r(float, int *);\r
-float lgammaf_r(float, int *);\r
-#endif /* !... || _REENTRANT */\r
-\r
-#endif  /* if 0 */\r
-\r
-///*\r
-// * Library implementation\r
-// */\r
-int __fpclassifyf(float);\r
-int __fpclassifyd(double);\r
-//int __isfinitef(float);\r
-//int __isfinited(double);\r
-int __isinff(float);\r
-int __isinfd(double);\r
-int __isnanf(float);\r
-int __isnand(double);\r
-//int __signbitf(float);\r
-//int __signbitd(double);\r
-\r
-//#ifdef __HAVE_LONG_DOUBLE\r
-int __fpclassifyl(long double);\r
-//int __isfinitel(long double);\r
-int __isinfl(long double);\r
-int __isnanl(long double);\r
-//int __signbitl(long double);\r
-//#endif\r
-__END_DECLS\r
+#define M_E         2.7182818284590452354   /**< e */\r
+#define M_LOG2E     1.4426950408889634074   /**< log 2e */\r
+#define M_LOG10E    0.43429448190325182765  /**< log 10e */\r
+#define M_LN2       0.69314718055994530942  /**< log e2 */\r
+#define M_LN10      2.30258509299404568402  /**< log e10 */\r
+#define M_PI        3.14159265358979323846  /**< pi */\r
+#define M_PI_2      1.57079632679489661923  /**< pi/2 */\r
+#define M_PI_4      0.78539816339744830962  /**< pi/4 */\r
+#define M_1_PI      0.31830988618379067154  /**< 1/pi */\r
+#define M_2_PI      0.63661977236758134308  /**< 2/pi */\r
+#define M_2_SQRTPI  1.12837916709551257390  /**< 2/sqrt(pi) */\r
+#define M_SQRT2     1.41421356237309504880  /**< sqrt(2) */\r
+#define M_SQRT1_2   0.70710678118654752440  /**< 1/sqrt(2) */\r
+#define MAXFLOAT  ((float)3.40282346638528860e+38)\r
+/*@}*/\r
 \r
 #endif /* _MATH_H_ */\r