Skip to content

Commit

Permalink
test: add missing tests
Browse files Browse the repository at this point in the history
PR-URL: #2701
Ref: 62e247d#commitcomment-144735358
Ref: 62e247d#r144735333
Reviewed-by: Athan Reines <[email protected]>
  • Loading branch information
gunjjoshi authored Jul 29, 2024
1 parent f00c6b6 commit 4d208c9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
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();
});

1 comment on commit 4d208c9

@stdlib-bot
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverage Report

Package Statements Branches Functions Lines
math/base/special/powm1 $\color{green}268/268$
$\color{green}+100.00\%$
$\color{green}25/25$
$\color{green}+100.00\%$
$\color{green}2/2$
$\color{green}+100.00\%$
$\color{green}268/268$
$\color{green}+100.00\%$

The above coverage report was generated for the changes in this push.

Please sign in to comment.