From b060af2264c9cecd960d19cd9f223d6b66ff1acc Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Tue, 18 Dec 2012 21:20:51 +0000 Subject: 2012-12-18 Craig Howland * libc/include/math.h: Add recognition of values 1 and 2 for FLT_EVAL_METHOD. --- newlib/ChangeLog | 5 +++++ newlib/libc/include/math.h | 34 ++++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 1043f89ee..887c18a9c 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,8 @@ +2012-12-18 Craig Howland + + * libc/include/math.h: Add recognition of values 1 and 2 for + FLT_EVAL_METHOD. + 2012-12-18 Corinna Vinschen * libc/stdio/puts.c (_puts_r): Fix typo in previous patch. Add local diff --git a/newlib/libc/include/math.h b/newlib/libc/include/math.h index e9328c55a..47725de37 100644 --- a/newlib/libc/include/math.h +++ b/newlib/libc/include/math.h @@ -140,11 +140,37 @@ extern double fmod _PARAMS((double, double)); /* ISO C99 types and macros. */ -#ifndef FLT_EVAL_METHOD -#define FLT_EVAL_METHOD 0 -typedef float float_t; -typedef double double_t; +/* FIXME: FLT_EVAL_METHOD should somehow be gotten from float.h (which is hard, + * considering that the standard says the includes it defines should not + * include other includes that it defines) and that value used. (This can be + * solved, but autoconf has a bug which makes the solution more difficult, so + * it has been skipped for now.) */ +#if !defined(FLT_EVAL_METHOD) && defined(__FLT_EVAL_METHOD__) + #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ + #define __TMP_FLT_EVAL_METHOD #endif /* FLT_EVAL_METHOD */ +#if defined FLT_EVAL_METHOD + #if FLT_EVAL_METHOD == 0 + typedef float float_t; + typedef double double_t; + #elif FLT_EVAL_METHOD == 1 + typedef double float_t; + typedef double double_t; + #elif FLT_EVAL_METHOD == 2 + typedef long double float_t; + typedef long double double_t; + #else + /* Implementation-defined. Assume float_t and double_t have been + * defined previously for this configuration (e.g. config.h). */ + #endif +#else + /* Assume basic definitions. */ + typedef float float_t; + typedef double double_t; +#endif +#if defined(__TMP_FLT_EVAL_METHOD) + #undef FLT_EVAL_METHOD +#endif #define FP_NAN 0 #define FP_INFINITE 1 -- cgit v1.2.3