Skip to content

Commit 56da07d

Browse files
committed
stmhal, math: Define _M_LN2 if not already defined.
Addresses issue adafruit#790.
1 parent dd07023 commit 56da07d

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

stmhal/math.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ float copysignf(float x, float y) {
102102
#ifdef log2f
103103
#undef log2f
104104
#endif
105+
// some compilers have _M_LN2 defined in math.h, some don't
106+
#ifndef _M_LN2
107+
#define _M_LN2 (0.69314718055994530942)
108+
#endif
105109
float log2f(float x) { return logf(x) / (float)_M_LN2; }
106110

107111
static const float _M_LN10 = 2.30258509299404; // 0x40135d8e

0 commit comments

Comments
 (0)