Skip to content
Open
Changes from 4 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
24 changes: 24 additions & 0 deletions lib/node_modules/@stdlib/math/base/special/xlog1py/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,27 @@ tape( 'the function evaluates `x * ln(y+1)` for large `x` and `y`', function tes
}
t.end();
});

tape( 'the function handles infinite values', function test( t ) {
Comment on lines 177 to +179
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.

Missing a blank line before this function definition. Please add one.

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.

var v;

v = xlog1py( Infinity, 1.0 );
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.

Two comments:

  1. All test messages should be returns expected value. No need for custom bespoke test messages.
  2. We don't use Infinity and -Infinity. We use associated constants packages. See other tests in math/base/special.

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.

done changes after checking other function tests

t.strictEqual( v, Infinity, 'Infinity * finite positive returns Infinity' );

v = xlog1py( Infinity, 0.0 );
t.strictEqual( isnan( v ), true, 'Infinity * 0 returns NaN' );

v = xlog1py( Infinity, -1.0 );
t.strictEqual( v, -Infinity, 'Infinity * negative returns -Infinity' );

v = xlog1py( 2.0, Infinity );
t.strictEqual( v, Infinity, 'finite positive * Infinity returns Infinity' );

v = xlog1py( -2.0, Infinity );
t.strictEqual( v, -Infinity, 'finite negative * Infinity returns -Infinity' );

v = xlog1py( 0.0, Infinity );
t.strictEqual( v, 0.0, '0 * Infinity returns 0' );

t.end();
});