Commit 7407ad3
committed
Fix NaN handling in ttftBucketIndex
The function didn't validate that ttftMs is a finite number. If ttftMs was
NaN or Infinity, Math.max(NaN, 1) would return NaN, causing Math.log(NaN)
to return NaN, and the entire calculation would produce NaN.
Added Number.isFinite() check to default to 0 for invalid numbers.
The existing test suite (11 tests, 995 assertions) already covers edge cases
including NaN, Infinity, and negative values, and all pass with this fix.1 parent 7b65652 commit 7407ad3
1 file changed
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
0 commit comments