Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export function log(x: number): number {
const seriesEpsilon = EPSILON * 16;
let n = 0;
while (x > 2) x /= 2, n++;
while (x < 0.5) x *= 2, n--;
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR metadata says it fixes issue #22 about fround hanging on small values, but this change only affects log() (and fround() does not call log() in this repo). Please either update the linked issue/PR description to reflect the actual bug being fixed, or include the corresponding fround fix if that's the intended target.

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change addresses convergence for x < 0.5, but the existing tests for log() only cover down to 0.5. Add test cases for very small positive values (e.g., Number.MIN_VALUE, 1e-300, subnormals) to prevent regressions (including non-termination/timeouts) and to validate accuracy against Math.log.

Copilot uses AI. Check for mistakes.

const z = (x - 1) / (x + 1), z2 = z * z;
let sum = 0, term = z, i = 1;
Expand Down
Loading