Syntax:
returned_word_variable = Log2 ( word_value )Command Availability:
Available on all microcontrollers.
Explanation:
The Log2 command returns the base-2 logarithm, to 2 decimal places.
The values returned are fixed-point numbers, with two decimal places assumed on the right — or, if you prefer, think of the values as being scaled up by 100.
Example:
dim log_value as word
log_value = log2 ( 10 ) ' <<< the Log2 instruction -- returns 3321, equating to 3.321Key line: log2 ( 10 ) — returns 3321, which represents 3.321 once the implied two decimal places are accounted for.
Supported in <MATHS.H>
See Also:
- Logarithms — overview of the log family of functions
- Loge — natural (base-e) logarithm
- Log10 — base-10 logarithm

