Skip to content
Closed
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
25 changes: 24 additions & 1 deletion docs/migration-guides/mathjs/benchmark/benchmark.exp.number.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,30 @@ bench( pkg+'::stdlib:math/base/special/exp:value=number', opts, function benchma
b.end();
});

// TODO: add math/special/exp benchmarks
// Add math/special/exp benchmarks
bench( pkg+'::stdlib:math/special/exp:value=number', opts, function benchmark( b ) {
var x;
var y;
var i;

x = filledBy( 100, uniform( -100.0, 100.0 ) );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
y = exp( x[ i%x.length ] );
if ( y !== y ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});



bench( pkg+'::mathjs:exp:value=number', opts, function benchmark( b ) {
var x;
Expand Down
Loading