Skip to content

Conversation

@edgar-bonet
Copy link
Contributor

Computing the logarithm is expensive on the AVR. On the other hand, the integer part of the base-2 logarithm is just the exponent field of the floating point representation, which is trivial to retrieve.

This commit replaces multiple calls to the full-blown logarithm by a cheap function, based on frexp(), which returns the base-2 logarithm rounded to the nearest integer.

Computing the logarithm is expensive on the AVR. On the other hand, the
integer part of the base-2 logarithm is just the exponent field of the
floating point representation, which is trivial to retrieve.

This commit replaces multiple calls to the full-blown logarithm by a
cheap function, based on frexp(), which returns the base-2 logarithm
rounded to the nearest integer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant