From c3a10b88b59f826485f7bff63879030d6ebe1b42 Mon Sep 17 00:00:00 2001 From: Olaf Barthel Date: Sun, 29 May 2005 10:09:55 +0000 Subject: [PATCH] =?UTF-8?q?-=C2=A0Added=20NAN,=20INFINITY,=20FLT=5FEVAL=5F?= =?UTF-8?q?METHOD,=20float=5Ft=20and=20double=5Ft=20to=20=20=20.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14959 87f5fb63-7c3d-0410-a384-fd976d0f7a62 --- library/changes | 3 +++ library/include/math.h | 21 ++++++++++++++++++++- library/math_init_exit.c | 14 +++++++++++++- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/library/changes b/library/changes index 2ee40f6..d13c684 100644 --- a/library/changes +++ b/library/changes @@ -45,6 +45,9 @@ negative and not EOF, the result was identical to the input, which could have had negative side-effects. +- Added NAN, INFINITY, FLT_EVAL_METHOD, float_t and double_t to + . + c.lib 1.192 (12.5.2005) diff --git a/library/include/math.h b/library/include/math.h index 89225ef..b97f0bf 100644 --- a/library/include/math.h +++ b/library/include/math.h @@ -1,5 +1,5 @@ /* - * $Id: math.h,v 1.10 2005-05-19 13:57:53 obarthel Exp $ + * $Id: math.h,v 1.11 2005-05-29 10:09:55 obarthel Exp $ * * :ts=4 * @@ -129,6 +129,16 @@ extern float __huge_val_float; /****************************************************************************/ +extern float __infinity; +extern float __nan; + +/****************************************************************************/ + +#define INFINITY ((const float)__infinity) +#define NAN ((const float)__nan) + +/****************************************************************************/ + #define FP_INFINITE 0 /* -/+ infinity */ #define FP_NAN 1 /* not a number */ #define FP_NORMAL 2 /* normalized floating point number */ @@ -233,6 +243,15 @@ extern float copysignf(float x, float y); /****************************************************************************/ +#define FLT_EVAL_METHOD 0 + +/****************************************************************************/ + +typedef float float_t; +typedef double double_t; + +/****************************************************************************/ + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/library/math_init_exit.c b/library/math_init_exit.c index 927195f..656b8f3 100644 --- a/library/math_init_exit.c +++ b/library/math_init_exit.c @@ -1,5 +1,5 @@ /* - * $Id: math_init_exit.c,v 1.16 2005-05-07 17:03:55 obarthel Exp $ + * $Id: math_init_exit.c,v 1.17 2005-05-29 10:09:54 obarthel Exp $ * * :ts=4 * @@ -73,6 +73,11 @@ struct Library * MathIeeeDoubTransBase; /****************************************************************************/ +float __infinity; +float __nan; + +/****************************************************************************/ + float __huge_val_float; double __huge_val; @@ -189,6 +194,13 @@ MATH_CONSTRUCTOR(math_init) } #endif /* USE_LONG_DOUBLE */ + /* Finally, fill in the constants behind INFINITY and NAN. */ + single_x = (union ieee_single *)&__infinity; + single_x->raw[0] = 0x7f800000; + + single_x = (union ieee_single *)&__nan; + single_x->raw[0] = 0x7fc00001; + success = TRUE; out: