Skip to content

Commit

Permalink
Improve q calcs
Browse files Browse the repository at this point in the history
  • Loading branch information
Slackadays committed Dec 8, 2023
1 parent 25fa81e commit 7ef054e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions mini2eq.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ function generate_apo(data) {

function q_setting(previous, current, next) {
if (previous == null)
return current / (next - current);
return current / (2 * (next - current));

if (next == null)
return current / (current - previous);
return current / (2 * (current - previous));

return current / (next - previous);
}
4 changes: 2 additions & 2 deletions mini2eq.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ def q_setting(previous: float, current: float, next: float) -> float:

# if the previous hertz value is 0, then calculate it based on the current and next hertz values
if previous == None:
return current / (next - current)
return current / (2 * (next - current))

# if the next hertz value is 0, then calculate it based on the current and previous hertz values
if next == None:
return current / (current - previous)
return current / (2 * (current - previous))

# otherwise, calculate it based on the previous and next hertz values
return current / (next - previous)
Expand Down

0 comments on commit 7ef054e

Please sign in to comment.