libm alternative in ports

Michael Grünewald michael.grunewald at laposte.net
Thu Nov 25 16:25:43 UTC 2010


Hello all,

Anonymous wrote:
> Alexander Best<arundel at freebsd.org>  writes:
>> does anybody if there's an alternative for libm in the ports dir? i need it,
>> because the newest snapshots of mplayer require log2() and log2f(), which the
>> base libm doesn't support.
>
> for mplayer I'd suggest using code from x264 because both projects use GPLv2+
>
>    #if !HAVE_LOG2F
>    #define log2f(x) (logf(x)/0.693147180559945f)
>    #define log2(x) (log(x)/0.693147180559945)
>    #endif

In `math.h', there is the following definition:

--8<---
#define M_LN2           0.69314718055994530942  /* log e2 */
--8<---

of which you can take advantage for your definition of log2f and log2. 
Note that this macro is not described in math(3).
-- 
Regards,
Michael


More information about the freebsd-questions mailing list