Skip to content

Commit 120c649

Browse files
fix: added tab indentation in files
1 parent 5c69c97 commit 120c649

File tree

2 files changed

+60
-60
lines changed

2 files changed

+60
-60
lines changed

lib/node_modules/@stdlib/stats/base/dists/uniform/median/benchmark/c/benchmark.c

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,22 @@
3131
* Prints the TAP version.
3232
*/
3333
static void print_version( void ) {
34-
printf( "TAP version 13\n" );
34+
printf( "TAP version 13\n" );
3535
}
3636

3737
/**
3838
* Prints the TAP summary.
3939
*
40-
* @param total total number of tests
41-
* @param passing total number of passing tests
40+
* @param total total number of tests
41+
* @param passing total number of passing tests
4242
*/
4343
static void print_summary( int total, int passing ) {
44-
printf( "#\n" );
45-
printf( "1..%d\n", total ); // TAP plan
46-
printf( "# total %d\n", total );
47-
printf( "# pass %d\n", passing );
48-
printf( "#\n" );
49-
printf( "# ok\n" );
44+
printf( "#\n" );
45+
printf( "1..%d\n", total ); // TAP plan
46+
printf( "# total %d\n", total );
47+
printf( "# pass %d\n", passing );
48+
printf( "#\n" );
49+
printf( "# ok\n" );
5050
}
5151

5252
/**
@@ -55,12 +55,12 @@ static void print_summary( int total, int passing ) {
5555
* @param elapsed elapsed time in seconds
5656
*/
5757
static void print_results( double elapsed ) {
58-
double rate = (double)ITERATIONS / elapsed;
59-
printf( " ---\n" );
60-
printf( " iterations: %d\n", ITERATIONS );
61-
printf( " elapsed: %0.9f\n", elapsed );
62-
printf( " rate: %0.9f\n", rate );
63-
printf( " ...\n" );
58+
double rate = (double)ITERATIONS / elapsed;
59+
printf( " ---\n" );
60+
printf( " iterations: %d\n", ITERATIONS );
61+
printf( " elapsed: %0.9f\n", elapsed );
62+
printf( " rate: %0.9f\n", rate );
63+
printf( " ...\n" );
6464
}
6565

6666
/**
@@ -69,9 +69,9 @@ static void print_results( double elapsed ) {
6969
* @return clock time
7070
*/
7171
static double tic( void ) {
72-
struct timeval now;
73-
gettimeofday( &now, NULL );
74-
return (double)now.tv_sec + (double)now.tv_usec/1.0e6;
72+
struct timeval now;
73+
gettimeofday( &now, NULL );
74+
return (double)now.tv_sec + (double)now.tv_usec/1.0e6;
7575
}
7676

7777
/**
@@ -80,45 +80,45 @@ static double tic( void ) {
8080
* @return elapsed time in seconds
8181
*/
8282
static double benchmark( void ) {
83-
double elapsed;
84-
double a, b;
85-
double y;
86-
double t;
87-
int i;
83+
double elapsed;
84+
double a, b;
85+
double y;
86+
double t;
87+
int i;
8888

89-
t = tic();
90-
for ( i = 0; i < ITERATIONS; i++ ) {
91-
a = ( (double)rand() / (double)RAND_MAX ) * 100.0; // Random lower bound between 0 and 100
92-
b = a + ( (double)rand() / (double)RAND_MAX ) * 100.0; // Random upper bound greater than a
93-
y = stdlib_base_dists_uniform_median( a, b );
94-
if ( y != y ) {
95-
printf( "should not return NaN\n" );
96-
break;
97-
}
98-
}
99-
elapsed = tic() - t;
100-
if ( y != y ) {
101-
printf( "should not return NaN\n" );
102-
}
103-
return elapsed;
89+
t = tic();
90+
for ( i = 0; i < ITERATIONS; i++ ) {
91+
a = ( (double)rand() / (double)RAND_MAX ) * 100.0; // Random lower bound between 0 and 100
92+
b = a + ( (double)rand() / (double)RAND_MAX ) * 100.0; // Random upper bound greater than a
93+
y = stdlib_base_dists_uniform_median( a, b );
94+
if ( y != y ) {
95+
printf( "should not return NaN\n" );
96+
break;
97+
}
98+
}
99+
elapsed = tic() - t;
100+
if ( y != y ) {
101+
printf( "should not return NaN\n" );
102+
}
103+
return elapsed;
104104
}
105105

106106
/**
107107
* Main execution sequence.
108108
*/
109109
int main( void ) {
110-
double elapsed;
111-
int i;
110+
double elapsed;
111+
int i;
112112

113-
// Use the current time to seed the random number generator:
114-
srand( time( NULL ) );
113+
// Use the current time to seed the random number generator:
114+
srand( time( NULL ) );
115115

116-
print_version();
117-
for ( i = 0; i < REPEATS; i++ ) {
118-
printf( "# c::%s\n", NAME );
119-
elapsed = benchmark();
120-
print_results( elapsed );
121-
printf( "ok %d benchmark finished\n", i+1 );
122-
}
123-
print_summary( REPEATS, REPEATS );
116+
print_version();
117+
for ( i = 0; i < REPEATS; i++ ) {
118+
printf( "# c::%s\n", NAME );
119+
elapsed = benchmark();
120+
print_results( elapsed );
121+
printf( "ok %d benchmark finished\n", i+1 );
122+
}
123+
print_summary( REPEATS, REPEATS );
124124
}

lib/node_modules/@stdlib/stats/base/dists/uniform/median/examples/c/example.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
#include <stdio.h>
2222

2323
int main( void ) {
24-
double a;
25-
double b;
26-
double y;
27-
int i;
24+
double a;
25+
double b;
26+
double y;
27+
int i;
2828

29-
for ( i = 0; i < 25; i++ ) {
30-
a = (double)rand() / ( (double)RAND_MAX + 1.0 ) * 100.0;
31-
b = a + ( (double)rand() / ( (double)RAND_MAX + 1.0 ) * 50.0 );
32-
y = stdlib_base_dists_uniform_median( a, b );
33-
printf( "a: %lf , b: %lf , Median: %lf\n", a, b, y );
34-
}
29+
for ( i = 0; i < 25; i++ ) {
30+
a = (double)rand() / ( (double)RAND_MAX + 1.0 ) * 100.0;
31+
b = a + ( (double)rand() / ( (double)RAND_MAX + 1.0 ) * 50.0 );
32+
y = stdlib_base_dists_uniform_median( a, b );
33+
printf( "a: %lf , b: %lf , Median: %lf\n", a, b, y );
34+
}
3535
}

0 commit comments

Comments
 (0)