Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add missing tests, return NaN in math/base/special/powm1 #2701

Merged
merged 1 commit into from
Jul 29, 2024
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 @@ -121,7 +121,7 @@ function powm1( b, x ) {
}
result = pow( b, x ) - 1.0;
if ( isinfinite( result ) || isnan( result ) ) {
return 0.0 / 0.0; // NaN
return NaN;
}
return result;
}
Expand Down
6 changes: 6 additions & 0 deletions lib/node_modules/@stdlib/math/base/special/powm1/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,9 @@ tape( 'the function returns `NaN` if provided a `NaN` for the base', function te
t.equal( isnan( y ), true, 'returns NaN' );
t.end();
});

tape( 'the function returns `NaN` if provided a `1e308` for the base and `2.0` for the exponent', function test( t ) {
var y = powm1( 1e308, 2.0 );
t.equal( isnan( y ), true, 'returns expected value' );
t.end();
});
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,9 @@ tape( 'the function returns `NaN` if provided a `NaN` for the base', opts, funct
t.equal( isnan( y ), true, 'returns expected value' );
t.end();
});

tape( 'the function returns `NaN` if provided a `1e308` for the base and `2.0` for the exponent', opts, function test( t ) {
var y = powm1( 1e308, 2.0 );
t.equal( isnan( y ), true, 'returns expected value' );
t.end();
});
Loading