Skip to content

Commit 16c7991

Browse files
authored
Merge pull request #23 from nberlette/fix/fround-hang
fix(log): ensure series expansion can handle small x values
2 parents f834bc6 + 4d0ee56 commit 16c7991

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

deno.lock

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/log.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export function log(x: number): number {
3333
const seriesEpsilon = EPSILON * 16;
3434
let n = 0;
3535
while (x > 2) x /= 2, n++;
36+
while (x < 0.5) x *= 2, n--;
3637

3738
const z = (x - 1) / (x + 1), z2 = z * z;
3839
let sum = 0, term = z, i = 1;

0 commit comments

Comments
 (0)