LOG - mkilgore/QB64pe GitHub Wiki
The LOG math function returns the natural logarithm of a specified numerical value.
- logarithm! = LOG(value)
- value MUST be greater than 0. "Illegal function call" error occurs if negative or zero values are used.
- The natural logarithm is the logarithm to the base e = 2.718282 (approximately).
- The natural logarithm of a is defined as the integral from 1 to a of dx/x.
- Returns are default SINGLE precision unless the value parameter uses DOUBLE precision.
Example 1: FUNCTION to find the base ten logarithm of a numerical value.
FUNCTION Log10#(value AS DOUBLE) STATIC Log10# = LOG(value) / LOG(10.#) END FUNCTION '' '' |
- Explanation: The natural logarithm of the value is divided by the base 10 logarithm. The LOG of ten is designated as a DOUBLE precision return by using # after the Log10 value. The return tells you the number of times 10 goes into a value.
- Explanation: The LOG of a positive INTEGER value is divided by the LOG of 2 to determine the number of binary digits that will be returned. The FOR loop compares the value with the exponents of two and determines if a bit is ON or OFF as "1" or "0".
- EXP, &B (binary number)
- Derived Trigonometric Functions
Navigation:
Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page