10-02-2023, 12:18 PM
As I see, QB64 only knows the logarithm function LOG() to the base e.
The following small program calculates the binary logarithm ( logarithm to the base of 2) and the logarithms to the base 10 and n
LOG10 is often called LG and
LOG is often LN (for natural logarithm).
Could these functions be implemented as standard QB64PE functions: _LOG2(), _LOG10(), LOGn(,)?
The following small program calculates the binary logarithm ( logarithm to the base of 2) and the logarithms to the base 10 and n
Code: (Select All)
DIM AS _FLOAT a, n a = 22 PRINT log2##(a) PRINT logn##(22, 2) PRINT logn##(22, 10) PRINT log10##(22) 'Function log2: logarithm to the base of 2 (binary logarithm) FUNCTION log2## (a) log2## = (LOG(a) / LOG(2)) END FUNCTION 'Function log10: logarithm of a to the base of n FUNCTION log10## (a) log10## = (log2##(a) / log2##(10)) END FUNCTION 'Function logn: logarithm of a to the base of n FUNCTION logn## (a, n) logn## = (log2##(a) / log2(n)) END FUNCTION
LOG10 is often called LG and
LOG is often LN (for natural logarithm).
Could these functions be implemented as standard QB64PE functions: _LOG2(), _LOG10(), LOGn(,)?