Skip to content

Commit 50438b5

Browse files
committed
libm: Provide log2f
1 parent 41e7148 commit 50438b5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/libm/math.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ float copysignf(float x, float y) {
5050

5151
static const float _M_LN10 = 2.30258509299404; // 0x40135d8e
5252
float log10f(float x) { return logf(x) / (float)_M_LN10; }
53+
#undef _M_LN2
54+
static const float _M_LN2 = 0.6931472;
55+
float log2f(float x) { return logf(x) / (float)_M_LN2; }
5356

5457
float tanhf(float x) {
5558
if (isinf(x)) {

0 commit comments

Comments
 (0)