Skip to content

Commit c94a8b2

Browse files
committed
bench: update value ranges
1 parent 2e75575 commit c94a8b2

File tree

9 files changed

+26
-26
lines changed

9 files changed

+26
-26
lines changed

lib/node_modules/@stdlib/math/base/special/erf/benchmark/benchmark.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ bench( pkg, function benchmark( b ) {
3434
var y;
3535
var i;
3636

37-
x = uniform( 10, -500.0, 500.0, {
37+
x = uniform( 10, -1.0, 1.0, {
3838
'dtype': 'generic'
3939
});
4040

lib/node_modules/@stdlib/math/base/special/erf/benchmark/benchmark.native.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ bench( pkg+'::native', opts, function benchmark( b ) {
4343
var y;
4444
var i;
4545

46-
x = uniform( 10, -500.0, 500.0, {
46+
x = uniform( 10, -1.0, 1.0, {
4747
'dtype': 'generic'
4848
});
4949

lib/node_modules/@stdlib/math/base/special/erf/benchmark/c/benchmark.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ static double benchmark( void ) {
9797

9898
t = tic();
9999
for ( i = 0; i < ITERATIONS; i++ ) {
100-
x = ( 1000.0*rand_double() ) - 500.0;
100+
x = ( 2.0*rand_double() ) - 1.0;
101101
y = erf( x );
102102
if ( y != y ) {
103103
printf( "should not return NaN\n" );

lib/node_modules/@stdlib/math/base/special/erf/benchmark/c/native/benchmark.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static double benchmark( void ) {
9898

9999
t = tic();
100100
for ( i = 0; i < ITERATIONS; i++ ) {
101-
x = ( 1000.0*rand_double() ) - 500.0;
101+
x = ( 2.0*rand_double() ) - 1.0;
102102
y = stdlib_base_erf( x );
103103
if ( y != y ) {
104104
printf( "should not return NaN\n" );

lib/node_modules/@stdlib/math/base/special/erf/benchmark/cpp/boost/benchmark.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ double benchmark() {
9595
mt19937 rng;
9696

9797
// Define a uniform distribution for generating pseudorandom numbers as "doubles" between a minimum value (inclusive) and a maximum value (exclusive):
98-
uniform_real_distribution<> randu( -500.0, 500.0 );
98+
uniform_real_distribution<> randu( -1.0, 1.0 );
9999

100100
t = tic();
101101
for ( i = 0; i < ITERATIONS; i++ ) {

lib/node_modules/@stdlib/math/base/special/erf/benchmark/julia/benchmark.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ julia> out = benchmark();
107107
```
108108
"""
109109
function benchmark()
110-
t = BenchmarkTools.@benchmark erf( (1000.0*rand()) - 500.0 ) samples=1e6
110+
t = BenchmarkTools.@benchmark erf( (2.0*rand()) - 1.0 ) samples=1e6
111111

112112
# Compute the total "elapsed" time and convert from nanoseconds to seconds:
113113
s = sum( t.times ) / 1.0e9;

lib/node_modules/@stdlib/math/base/special/erf/benchmark/python/benchmark.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def print_results(elapsed):
7373
def benchmark():
7474
"""Run the benchmark and print benchmark results."""
7575
setup = "from math import erf; from random import random;"
76-
stmt = "y = erf(1000.0*random() - 500.0)"
76+
stmt = "y = erf(2.0*random() - 1.0)"
7777

7878
t = timeit.Timer(stmt, setup=setup)
7979

lib/node_modules/@stdlib/math/base/special/erf/benchmark/python/scipy/benchmark.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def print_results(elapsed):
7373
def benchmark():
7474
"""Run the benchmark and print benchmark results."""
7575
setup = "from scipy.special import erf; from random import random;"
76-
stmt = "y = erf(1000.0*random() - 500.0)"
76+
stmt = "y = erf(2.0*random() - 1.0)"
7777

7878
t = timeit.Timer(stmt, setup=setup)
7979

lib/node_modules/@stdlib/math/base/special/erf/benchmark/r/benchmark.R

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ options( digits = 16L );
2525
#' main();
2626
main <- function() {
2727
# Define benchmark parameters:
28-
name <- "erf";
28+
name <- 'erf';
2929
iterations <- 1000000L;
3030
repeats <- 3L;
3131

@@ -34,7 +34,7 @@ main <- function() {
3434
#' @examples
3535
#' print_version();
3636
print_version <- function() {
37-
cat( "TAP version 13\n" );
37+
cat( 'TAP version 13\n' );
3838
}
3939

4040
#' Print the TAP summary.
@@ -45,12 +45,12 @@ main <- function() {
4545
#' @examples
4646
#' print_summary( 3, 3 );
4747
print_summary <- function( total, passing ) {
48-
cat( "#\n" );
49-
cat( paste0( "1..", total, "\n" ) ); # TAP plan
50-
cat( paste0( "# total ", total, "\n" ) );
51-
cat( paste0( "# pass ", passing, "\n" ) );
52-
cat( "#\n" );
53-
cat( "# ok\n" );
48+
cat( '#\n' );
49+
cat( paste0( '1..', total, '\n' ) ); # TAP plan
50+
cat( paste0( '# total ', total, '\n' ) );
51+
cat( paste0( '# pass ', passing, '\n' ) );
52+
cat( '#\n' );
53+
cat( '# ok\n' );
5454
}
5555

5656
#' Print benchmark results.
@@ -62,11 +62,11 @@ main <- function() {
6262
#' print_results( 10000L, 0.131009101868 );
6363
print_results <- function( iterations, elapsed ) {
6464
rate <- iterations / elapsed;
65-
cat( " ---\n" );
66-
cat( paste0( " iterations: ", iterations, "\n" ) );
67-
cat( paste0( " elapsed: ", elapsed, "\n" ) );
68-
cat( paste0( " rate: ", rate, "\n" ) );
69-
cat( " ...\n" );
65+
cat( ' ---\n' );
66+
cat( paste0( ' iterations: ', iterations, '\n' ) );
67+
cat( paste0( ' elapsed: ', elapsed, '\n' ) );
68+
cat( paste0( ' rate: ', rate, '\n' ) );
69+
cat( ' ...\n' );
7070
}
7171

7272
#' Error function.
@@ -96,10 +96,10 @@ main <- function() {
9696
#' elapsed <- benchmark( 10000L );
9797
benchmark <- function( iterations ) {
9898
# Run the benchmarks:
99-
results <- microbenchmark::microbenchmark( erf( (1000.0*runif(1)) - 500.0 ), times = iterations );
99+
results <- microbenchmark::microbenchmark( erf( (2.0*runif(1L)) - 1.0 ), times = iterations );
100100

101101
# Sum all the raw timing results to get a total "elapsed" time:
102-
elapsed <- sum( results$time );
102+
elapsed <- sum( results[[ time ]] );
103103

104104
# Convert the elapsed time from nanoseconds to seconds:
105105
elapsed <- elapsed / 1.0e9;
@@ -108,11 +108,11 @@ main <- function() {
108108
}
109109

110110
print_version();
111-
for ( i in 1:repeats ) {
112-
cat( paste0( "# r::", name, "\n" ) );
111+
for ( i in 1L:repeats ) {
112+
cat( paste0( '# r::', name, '\n' ) );
113113
elapsed <- benchmark( iterations );
114114
print_results( iterations, elapsed );
115-
cat( paste0( "ok ", i, " benchmark finished", "\n" ) );
115+
cat( paste0( 'ok ', i, ' benchmark finished', '\n' ) );
116116
}
117117
print_summary( repeats, repeats );
118118
}

0 commit comments

Comments
 (0)