Index: ChangeLog =================================================================== RCS file: /cvs/src/src/newlib/ChangeLog,v retrieving revision 1.1483 diff -p -u -r1.1483 ChangeLog --- ChangeLog 23 Feb 2010 23:13:20 -0000 1.1483 +++ ChangeLog 24 Feb 2010 01:22:29 -0000 @@ -1,3 +1,11 @@ +2010-02-23 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-02-23 Jeff Johnston * libc/include/sys/types.h: Fix __XMK__ sectioning and remove Index: libm/common/s_log2.c =================================================================== RCS file: /cvs/src/src/newlib/libm/common/s_log2.c,v retrieving revision 1.2 diff -p -u -r1.2 s_log2.c --- libm/common/s_log2.c 25 Mar 2009 19:13:01 -0000 1.2 +++ libm/common/s_log2.c 24 Feb 2010 01:22:29 -0000 @@ -34,8 +34,8 @@ The Newlib implementations are not full, 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 Definitio double x; #endif { - return (log(x) / M_LOG2_E); + return (log(x) / M_LN2); } #endif /* defined(_DOUBLE_IS_32BITS) */ Index: libm/common/sf_log2.c =================================================================== RCS file: /cvs/src/src/newlib/libm/common/sf_log2.c,v retrieving revision 1.1 diff -p -u -r1.1 sf_log2.c --- libm/common/sf_log2.c 18 Mar 2009 18:11:18 -0000 1.1 +++ libm/common/sf_log2.c 24 Feb 2010 01:22:29 -0000 @@ -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 Index: libc/include/math.h =================================================================== RCS file: /cvs/src/src/newlib/libc/include/math.h,v retrieving revision 1.45 diff -p -u -r1.45 math.h --- libc/include/math.h 11 Jan 2010 22:55:47 -0000 1.45 +++ libc/include/math.h 24 Feb 2010 01:22:29 -0000 @@ -32,7 +32,7 @@ union __ldmath #endif /* Natural log of 2 */ -#define _M_LOG2_E 0.693147180559945309417 +#define _M_LN2 0.693147180559945309417 #if defined(__GNUC__) && \ ( (__GNUC__ >= 4) || \ @@ -276,7 +276,7 @@ extern double erf _PARAMS((double)); extern double erfc _PARAMS((double)); extern double log2 _PARAMS((double)); #if !defined(__cplusplus) -#define log2(x) (log (x) / _M_LOG2_E) +#define log2(x) (log (x) / _M_LN2) #endif #ifndef __math_68881 @@ -356,7 +356,7 @@ extern float erff _PARAMS((float)); extern float erfcf _PARAMS((float)); extern float log2f _PARAMS((float)); #if !defined(__cplusplus) -#define log2f(x) (logf (x) / (float) _M_LOG2_E) +#define log2f(x) (logf (x) / (float_t) _M_LN2) #endif extern float hypotf _PARAMS((float, float)); #endif /* ! defined (_REENT_ONLY) */ @@ -548,7 +548,7 @@ extern int matherr _PARAMS((struct excep #define M_LN2HI 6.9314718036912381649E-1 #define M_SQRT3 1.73205080756887719000 #define M_IVLN10 0.43429448190325182765 /* 1 / log(10) */ -#define M_LOG2_E _M_LOG2_E +#define M_LOG2_E _M_LN2 #define M_INVLN2 1.4426950408889633870E0 /* 1 / log(2) */ /* Global control over fdlibm error handling. */