Skip to content

Commit 4f592a2

Browse files
committed
changes updated
1 parent 4be1efa commit 4f592a2

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static double benchmark( void ) {
9393
double elapsed;
9494
double x1[100];
9595
double x2[100];
96-
double* y = ( double* )malloc(2 * sizeof(double));
96+
double y[] = { 0.0, 0.0 };
9797
double t;
9898
int i;
9999

@@ -104,7 +104,7 @@ static double benchmark( void ) {
104104

105105
t = tic();
106106
for ( i = 0; i < ITERATIONS; i++ ) {
107-
y = stdlib_base_minmax( x1[ i % 100 ], x2[ i % 100 ] );
107+
stdlib_base_minmax( x1[ i % 100 ], x2[ i % 100 ], &y, 1, 0 );
108108
if ( y != y ) {
109109
printf( "should not return NaN\n" );
110110
break;

lib/node_modules/@stdlib/math/base/special/minmax/examples/c/example.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ int main(void) {
2424
const double x1[] = { 1.0, 0.45, -0.89, 0.0 / 0.0, -0.78, -0.22, 0.66, 0.11, -0.55, 0.0 };
2525
const double x2[] = { -0.22, 0.66, 0.0, -0.55, 0.33, 1.0, 0.0 / 0.0, 0.11, 0.45, -0.78 };
2626

27-
double* v = ( double* )malloc(2 * sizeof(double));
2827
int i;
2928
for ( i = 0; i < 10; i++ ) {
30-
v = stdlib_base_minmax( x1[ i ], x2[ i ] );
31-
printf( "x1[ %d ]: %lf, x2[ %d ]: %lf, minmax( x1[ %d ], x2[ %d ] ): ( %lf, %lf )\n", i, x1[ i ], i, x2[ i ], i, i, v[0], v[1] );
29+
double out[] = { 0.0, 0.0 };
30+
stdlib_base_minmax( x1[ i ], x2[ i ], &out, 1, 0 );
31+
printf( "x1[ %d ]: %lf, x2[ %d ]: %lf, minmax( x1[ %d ], x2[ %d ] ): ( %lf, %lf )\n", i, x1[ i ], i, x2[ i ], i, i, out[0], out[1] );
3232
}
3333
}
3434

lib/node_modules/@stdlib/math/base/special/minmax/include/stdlib/math/base/special/minmax.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ extern "C" {
3737
* @param y Second value
3838
* @return A double containing the minimum and maximum values
3939
*/
40-
double* stdlib_base_minmax(const double x, const double y, double* out, int stride, int offset );
40+
void stdlib_base_minmax(const double x, const double y, double* out, int stride, int offset );
4141

4242
#ifdef __cplusplus
4343
}

lib/node_modules/@stdlib/math/base/special/minmax/src/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
*/
3636

3737

38-
double* stdlib_base_minmax( const double x, const double y, double* out, int stride, int offset ) {
38+
void stdlib_base_minmax( const double x, const double y, double* out, int stride, int offset ) {
3939

4040
if( stdlib_base_is_nan( x ) || stdlib_base_is_nan( y ) ){
4141
out[ offset ] = 0.0 / 0.0;
@@ -46,6 +46,6 @@ double* stdlib_base_minmax( const double x, const double y, double* out, int str
4646
out[ offset + stride ] = stdlib_base_max( x, y );
4747
}
4848

49-
return out;
49+
return;
5050

5151
}

0 commit comments

Comments
 (0)