diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b48321..a2551d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@
+- [`6bbf2d6`](https://github.com/stdlib-js/stdlib/commit/6bbf2d67034e056190594bf2bceca4eb40a66b6f) - **style:** fix indentation _(by Philipp Burckhardt)_ - [`3b4514d`](https://github.com/stdlib-js/stdlib/commit/3b4514d1272ea9e4863381e3d0febd02ba8d230f) - **feat:** add `math/base/special/negalucasf` _(by Aayush Khanna, stdlib-bot, Philipp Burckhardt)_
diff --git a/benchmark/c/native/benchmark.c b/benchmark/c/native/benchmark.c index 1dc2136..1b2be2a 100644 --- a/benchmark/c/native/benchmark.c +++ b/benchmark/c/native/benchmark.c @@ -31,7 +31,7 @@ * Prints the TAP version. */ void print_version() { - printf( "TAP version 13\n" ); + printf( "TAP version 13\n" ); } /** @@ -41,12 +41,12 @@ void print_version() { * @param passing total number of passing tests */ static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); + printf( "#\n" ); + printf( "1..%d\n", total ); // TAP plan + printf( "# total %d\n", total ); + printf( "# pass %d\n", passing ); + printf( "#\n" ); + printf( "# ok\n" ); } /** @@ -55,12 +55,12 @@ static void print_summary( int total, int passing ) { * @param elapsed elapsed time in seconds */ static void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); + double rate = (double)ITERATIONS / elapsed; + printf( " ---\n" ); + printf( " iterations: %d\n", ITERATIONS ); + printf( " elapsed: %0.9f\n", elapsed ); + printf( " rate: %0.9f\n", rate ); + printf( " ...\n" ); } /** @@ -69,9 +69,9 @@ static void print_results( double elapsed ) { * @return clock time */ static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; + struct timeval now; + gettimeofday( &now, NULL ); + return (double)now.tv_sec + (double)now.tv_usec/1.0e6; } /** @@ -80,8 +80,8 @@ static double tic( void ) { * @return random number */ static float rand_float( void ) { - int r = rand(); - return (float)r / ( (float)RAND_MAX + 1.0f ); + int r = rand(); + return (float)r / ( (float)RAND_MAX + 1.0f ); } /** @@ -90,47 +90,47 @@ static float rand_float( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { - double elapsed; - int32_t x[ 100 ]; - double t; - float y; - int i; + double elapsed; + int32_t x[ 100 ]; + double t; + float y; + int i; for ( i = 0; i < 100; i++ ) { x[ i ] = (int32_t)( 34.0f * rand_float() ); } - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - y = stdlib_base_negalucasf( x[ i % 100 ] ); - if ( y != y ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( y != y ) { - printf( "should not return NaN\n" ); - } - return elapsed; + t = tic(); + for ( i = 0; i < ITERATIONS; i++ ) { + y = stdlib_base_negalucasf( x[ i % 100 ] ); + if ( y != y ) { + printf( "should not return NaN\n" ); + break; + } + } + elapsed = tic() - t; + if ( y != y ) { + printf( "should not return NaN\n" ); + } + return elapsed; } /** * Main execution sequence. */ int main( void ) { - double elapsed; - int i; + double elapsed; + int i; - // Use the current time to seed the random number generator: - srand( time( NULL ) ); + // Use the current time to seed the random number generator: + srand( time( NULL ) ); - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); + print_version(); + for ( i = 0; i < REPEATS; i++ ) { + printf( "# c::native::%s\n", NAME ); + elapsed = benchmark(); + print_results( elapsed ); + printf( "ok %d benchmark finished\n", i+1 ); + } + print_summary( REPEATS, REPEATS ); }