diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2010-12-02 19:57:43 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2010-12-02 19:57:43 +0000 |
commit | 8d3c10d72b59e2898af77470505533881f96ee21 (patch) | |
tree | 2f7336b580634d7ead1b9508ba478a6f3b75bd5d | |
parent | 8ae0b98903893e68a52baa9a2e3df574f0d7a39e (diff) | |
download | newlib-8d3c10d72b59e2898af77470505533881f96ee21.zip newlib-8d3c10d72b59e2898af77470505533881f96ee21.tar.gz newlib-8d3c10d72b59e2898af77470505533881f96ee21.tar.bz2 |
2010-12-02 Craig Howland <howland@LGSInnovations.com>
* 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).
-rw-r--r-- | newlib/ChangeLog | 8 | ||||
-rw-r--r-- | newlib/libm/common/s_log2.c | 6 | ||||
-rw-r--r-- | newlib/libm/common/sf_log2.c | 2 |
3 files changed, 12 insertions, 4 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index d1ae16f..574ae50 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,11 @@ +2010-12-02 Craig Howland <howland@LGSInnovations.com> + + * 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 7ad2cd8..e508785 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 <<log>>. (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 <<matherr>> 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 eb8863c..9fbaaca 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 |