Skip to content

Commit

Permalink
fix: Incorrect safeDiv
Browse files Browse the repository at this point in the history
  • Loading branch information
nonphoto committed Mar 3, 2025
1 parent 6cabdf6 commit 74c475a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { copysign, HALF_PI, QUARTER_PI, safeDiv, TAU } from "@thi.ng/math";
import { copysign, HALF_PI, QUARTER_PI, TAU } from "@thi.ng/math";

const TWO_LN2 = 2 * Math.LN2;

Expand All @@ -9,6 +9,11 @@ export const defaultDamping = halflifeToDamping(200);
export const defaultCriticality = 0;
export const defaultEpsilon = 0.01;

function safeDiv(a: number, b: number): number {
const c = a / b;
return isNaN(c) ? 0 : c;
}

function square(x: number): number {
return x * x;
}
Expand Down

0 comments on commit 74c475a

Please sign in to comment.