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).
This commit is contained in:
Jeff Johnston 2010-12-02 19:57:43 +00:00
parent 8ae0b98903
commit 8d3c10d72b
3 changed files with 12 additions and 4 deletions

View File

@ -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

View File

@ -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) */

View File

@ -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