feat: add stats/incr/nanmax#5989
Conversation
Coverage Report
The above coverage report was generated for the changes in this PR. |
|
@kgryte, Removed all the linting errors, Please review this PR once again. |
|
/stdlib merge |
|
/stdlib merge |
| { | ||
| "name": "@stdlib/stats/incr/nanmax", | ||
| "version": "0.0.0", | ||
| "description": "Compute a maximum value incrementally, while ignoring `NaN` values.", |
There was a problem hiding this comment.
No backticks around NaN in package.json descriptions.
| "description": "Compute a maximum value incrementally, while ignoring `NaN` values.", | |
| "description": "Compute a maximum value incrementally, while ignoring NaN values.", |
| * | ||
| * ## Notes | ||
| * | ||
| * - If provided `NaN` or a value which, when used in computations, results in `NaN`, the accumulated value is `NaN` for all future invocations. |
There was a problem hiding this comment.
This note is copied from incrmax and contradicts the NaN-ignoring behavior of this package.
| * - If provided `NaN` or a value which, when used in computations, results in `NaN`, the accumulated value is `NaN` for all future invocations. | |
| * - If provided `NaN`, the value is ignored and the accumulated value remains unchanged. |
| v = randu() * 100.0; | ||
| } | ||
| max = accumulator( v ); | ||
| console.log( '%d\t%d', v.toFixed( 4 ), ( max === null ) ? NaN : max.toFixed( 4 ) ); |
There was a problem hiding this comment.
.toFixed() returns a string, so %d will coerce it back to a number and strip trailing zeros. Use %s instead.
| console.log( '%d\t%d', v.toFixed( 4 ), ( max === null ) ? NaN : max.toFixed( 4 ) ); | |
| console.log( '%s\t%s', v.toFixed( 4 ), ( max === null ) ? 'null' : max.toFixed( 4 ) ); |
Requested changes applied in the maintainer cleanup commit: removed the incorrect NaN note in index.d.ts, dropped the package.json description backticks, and fixed the example output. Dismissing the stale review.
a0ac52c to
633fac5
Compare
- Remove incorrect NaN-propagation note from index.d.ts (contradicted the NaN-ignoring behavior) - Drop backticks from package.json description and align README/repl wording - Remove inappropriate overflow note (a maximum does not accumulate/sum) - Fix examples output to use %s and guard against a null accumulated value - Remove a stray tab in a test title; add an all-NaN returns-null test - Bump copyright year to 2026
PR Commit MessagePlease review the above commit message and make any necessary adjustments. |
Resolves #5550
Description
This pull request:
Related Issues
This pull request:
stats/incr/nanmax#5550Questions
No.
Other
No.
Checklist
@stdlib-js/reviewers