diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2010-12-02 22:57:43 +0300 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2010-12-02 22:57:43 +0300 |
commit | 8d3c10d72b59e2898af77470505533881f96ee21 (patch) | |
tree | 2f7336b580634d7ead1b9508ba478a6f3b75bd5d /newlib/libm/common | |
parent | 8ae0b98903893e68a52baa9a2e3df574f0d7a39e (diff) |
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).
Diffstat (limited to 'newlib/libm/common')
-rw-r--r-- | newlib/libm/common/s_log2.c | 6 | ||||
-rw-r--r-- | newlib/libm/common/sf_log2.c | 2 |
2 files changed, 4 insertions, 4 deletions
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 <<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 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 |