Skip to content
Open
Changes from 1 commit
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
17 changes: 17 additions & 0 deletions lib/node_modules/@stdlib/math/base/special/log1pmx/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,20 @@ tape( 'the function returns a Taylor series expansion otherwise', function test(
}
t.end();
});
tape( 'the function handles special values', function test( t ) {
var v;

v = log1pmx( NaN );
t.strictEqual( isnan( v ), true, 'returns NaN for NaN' );

v = log1pmx( Infinity );
t.strictEqual( isnan( v ), true, 'returns NaN for +Infinity' );

v = log1pmx( -Infinity );
t.strictEqual( isnan( v ), true, 'returns NaN for -Infinity' );

v = log1pmx( -0.0 );
t.strictEqual( Object.is( v, -0.0 ), true, 'preserves negative zero' );
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.

Why does this make sense?

Copy link
Copy Markdown
Author

@ashish-066 ashish-066 Jan 2, 2026

Choose a reason for hiding this comment

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

the current implementation already preserves -0. The purpose of this test is to explicitly specify

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.

And I am asking you to think more critically about whether that makes sense.

In general, we should not be adding tests for the sake of adding tests. Adding tests such as those you have added here document the desired public contract with downstream consumers. We should ensure that the contract makes sense mathematically. It is possible that the implementation is incorrect.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sorry for the misunderstanding. You are right there is no mathematical necessity to specify signed zero behavior for log1pmx.I have removed the -0 test case


t.end();
});