Skip to content

Compute the EV more efficiently#7

Open
edgar-bonet wants to merge 2 commits intoLexOptical:masterfrom
edgar-bonet:cheap-log
Open

Compute the EV more efficiently#7
edgar-bonet wants to merge 2 commits intoLexOptical:masterfrom
edgar-bonet:cheap-log

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