From 50438b51aa0af3f6453f334d3868f0a87eb94a89 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 4 Feb 2020 09:41:44 -0600 Subject: [PATCH] libm: Provide log2f --- lib/libm/math.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/libm/math.c b/lib/libm/math.c index 39c6a68a5e..0e53563bcb 100644 --- a/lib/libm/math.c +++ b/lib/libm/math.c @@ -50,6 +50,9 @@ float copysignf(float x, float y) { static const float _M_LN10 = 2.30258509299404; // 0x40135d8e float log10f(float x) { return logf(x) / (float)_M_LN10; } +#undef _M_LN2 +static const float _M_LN2 = 0.6931472; +float log2f(float x) { return logf(x) / (float)_M_LN2; } float tanhf(float x) { if (isinf(x)) {