 Status Closed
 Percent Complete
 Task Type Patches
 Category Plugins
 Assigned To Noone
 Operating System All players
 Severity Low
 Priority Very Low
 Reported Version Release 3.4
 Due in Version Undecided

Due Date
Undecided
 Votes
 Private
FS#11229  FFT: math rework
Simplifies the math routines, removes all 64bit math and unused 64bit math sqrt function.
Closed by Buschel
20100512 02:42
Reason for closing: Accepted
Additional comments about closing:
20100512 02:42
Reason for closing: Accepted
Additional comments about closing:
Submitted with r25790
Loading...
Available keyboard shortcuts
 Alt + ⇧ Shift + l Login Dialog / Logout
 Alt + ⇧ Shift + a Add new task
 Alt + ⇧ Shift + m My searches
 Alt + ⇧ Shift + t focus taskid search
Tasklist
 o open selected task
 j move cursor down
 k move cursor up
Task Details
 n Next task
 p Previous task
 Alt + ⇧ Shift + e ↵ Enter Edit this task
 Alt + ⇧ Shift + w watch task
 Alt + ⇧ Shift + y Close Task
Task Editing
 Alt + ⇧ Shift + s save task
Just a quick note. It seem that in some cases you’re first calculating a square root and then taking the logarithm. This can probably combined more efficiently (haven’t tested it though):
* just take the logarithm without doing the square root first
* divide the result by 2
This uses the mathematical property log(x^a) = a log (x), where a = 0.5 in this case
While that’s technically true, I can’t see how to use it here. Let me explain:
Before the if (tmp>0) bit, tmp is at most 29 bits (an assumption made throughout the code). The sqrt call makes sure that it’s at most 14 bits, so that the right shift does not overflow.
If I don’t do the sqrt, the right shift is virtually guaranteed to overflow, which is what this refactoring is trying to fix.
If I don’t do the right shift at all but just leave the log call (it *is* in theory a linear mapping), values < 0xFFFF will be treated as less than 1, resulting in negative and quite large values for tmp  obviously not the desired outcome. Therefore, the right shift is needed and therefore, the sqrt call is needed to guarantee that the shift does not overflow.
If I’m missing something, do let me know.
Sorry, that should say left shift, obviously.
Wasn’t this submitted with r25790?
It was. I don’t have the necessary privileges on FS to close the task (and frankly, I forgot about it :) )