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
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* // returns 0.5
*
* y = bernoullif( 2 );
* // returns ~0.166
* // returns ~0.167
*
* y = bernoullif( 3 );
* // returns 0.0
Expand Down

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why -0.0, 0 is same in positive & negative

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

0.0 and -0.0 compare equal under ===, but they are distinct IEEE 754 values (Object.is( -0.0, 0.0 ) is false, and 1.0/-0.0 is -Infinity). stdlib doctest annotations distinguish signed zeros, so // returns 0.0 asserts a positive zero.

Here the implementation returns log1p( -pow( beta/x, alpha ) ). For x = +Infinity, that is log1p( -0.0 ), which is -0.0. lib/main.js, lib/index.js, and README.md already annotate -0.0, and 757c4d1 made the same correction in stats/base/dists/weibull/logcdf/lib/native.js.


Generated by Claude Code

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Floating-point zero can be signed.

Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var addon = require( './../src/addon.node' );
*
* @example
* var y = logcdf( +Infinity, 4.0, 2.0 );
* // returns 0.0
* // returns -0.0
*
* @example
* var y = logcdf( 2.0, -1.0, 0.5 );
Expand Down