diff --git a/newlib/ChangeLog b/newlib/ChangeLog index d1ae16fa1..574ae506f 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,11 @@ +2010-12-02 Craig Howland + + * libm/common/s_log2.c: Change from using M_LOG2_E to M_LN2 define + (from math.h--the latter is POSIX, the former non-standard). + * libm/common/sf_log2.c: Ditto. Change cast for M_LN2 from float to + float_t (in case all math not done in float). + * libc/include/math.h: Ditto (same 2 things as sf_log2.c). + 2010-12-02 Jayant Sonar jayant.sonar@kpitcummins.com Kaushik Phatak kaushik.phatak@kpitcummins.com diff --git a/newlib/libm/common/s_log2.c b/newlib/libm/common/s_log2.c index 7ad2cd88b..e5087858b 100644 --- a/newlib/libm/common/s_log2.c +++ b/newlib/libm/common/s_log2.c @@ -34,8 +34,8 @@ The Newlib implementations are not full, intrinisic calculations, but rather are derivatives based on <>. (Accuracy might be slightly off from a direct calculation.) In addition to functions, they are also implemented as macros defined in math.h: -. #define log2(x) (log (x) / _M_LOG2_E) -. #define log2f(x) (logf (x) / (float) _M_LOG2_E) +. #define log2(x) (log (x) / _M_LN2) +. #define log2f(x) (logf (x) / (float) _M_LN2) To use the functions instead, just undefine the macros first. You can use the (non-ANSI) function <> to specify error @@ -79,7 +79,7 @@ C99, POSIX, System V Interface Definition (Issue 6). double x; #endif { - return (log(x) / M_LOG2_E); + return (log(x) / M_LN2); } #endif /* defined(_DOUBLE_IS_32BITS) */ diff --git a/newlib/libm/common/sf_log2.c b/newlib/libm/common/sf_log2.c index eb8863c9f..9fbaaca72 100644 --- a/newlib/libm/common/sf_log2.c +++ b/newlib/libm/common/sf_log2.c @@ -30,7 +30,7 @@ float x; #endif { - return (logf(x) / (float) M_LOG2_E); + return (logf(x) / (float_t) M_LN2); } #ifdef _DOUBLE_IS_32BITS