1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

- For the printf() "%a" conversion the exponent now comes out as a binary

number rather than a decimal one. Now how odd is that?

- strtod() and strtof() now support "inf"/"infinity"/"nan"/"nan(..)" and
  hexadecimal floating point numbers, for C99.

- Added the fpclassify(), isfinite(), isnormal() and signbit() macros for C99.

- Reimplemented isnan() and isinf() as macros for C99. The corresponding
  functions will be dropped from the library. Note that the isinf() macro
  does not return -1, 0 or 1 like the old function did, but only 0 or 1
  depending upon whether the parameter represents +/- infinity or not.

- Added fabsf() for C99.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14935 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2005-05-08 08:51:30 +00:00
parent c8d29ea9c1
commit 9e32991a6d
15 changed files with 1007 additions and 291 deletions

View File

@@ -1,5 +1,5 @@
/*
* $Id: math.h,v 1.7 2005-05-07 17:04:07 obarthel Exp $
* $Id: math.h,v 1.8 2005-05-08 08:51:30 obarthel Exp $
*
* :ts=4
*
@@ -103,8 +103,6 @@ extern double tanh(double x);
extern double rint(double x);
extern float rintf(float x);
extern int isinf(double x);
extern int isnan(double x);
extern double logb(double x);
extern double hypot(double x,double y);
@@ -123,6 +121,51 @@ extern float __huge_val_float;
/****************************************************************************/
#define FP_INFINITE 0 /* -/+ infinity */
#define FP_NAN 1 /* not a number */
#define FP_NORMAL 2 /* normalized floating point number */
#define FP_SUBNORMAL 3 /* very small floating point number; special
case of IEEE 754 */
#define FP_ZERO 4 /* exponent/fraction are zero */
/****************************************************************************/
extern int __fpclassify_float(float x);
extern int __fpclassify_double(double x);
extern int __isfinite_float(float x);
extern int __isfinite_double(double x);
extern int __signbit_float(float x);
extern int __signbit_double(double x);
#define fpclassify(x) \
((sizeof(x) == sizeof(float)) ? __fpclassify_float(x) : __fpclassify_double(x))
#define isfinite(x) \
((sizeof(x) == sizeof(float)) ? __isfinite_single(x) : __isfinite_double(x))
#define isinf(x) \
(((sizeof(x) == sizeof(float)) ? __fpclassify_float(x) : __fpclassify_double(x)) == FP_INFINITE)
#define isnan(x) \
(((sizeof(x) == sizeof(float)) ? __fpclassify_float(x) : __fpclassify_double(x)) == FP_NAN)
#define isnormal(x) \
(((sizeof(x) == sizeof(float)) ? __fpclassify_float(x) : __fpclassify_double(x)) == FP_NORMAL)
#define signbit(x) \
((sizeof(x) == sizeof(float)) ? __signbit_single(x) : __signbit_double(x))
/****************************************************************************/
extern float fabsf(float x);
/****************************************************************************/
extern float nanf(const char *tagp);
extern double nan(const char *tagp);
/****************************************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */