22
33@license Apache-2.0
44
5- Copyright (c) 2024 The Stdlib Authors.
5+ Copyright (c) 2018 The Stdlib Authors.
66
77Licensed under the Apache License, Version 2.0 (the "License");
88you may not use this file except in compliance with the License.
@@ -146,16 +146,18 @@ for ( i = 0; i < 100; i++ ) {
146146#include " stdlib/math/base/special/minmax.h"
147147```
148148
149- #### stdlib_base_minmax( x, y )
149+ #### stdlib_base_minmax( x, y, &min, &max )
150150
151- Returns the minimum and maximum value.
151+ Gives the minimum and maximum value.
152152
153153``` c
154- double out = stdlib_base_minmax( 4.2 , 3.14 );
155- // returns [ 3.14, 4.2 ]
154+ double min;
155+ double max;
156+ stdlib_base_minmax ( 4.2, 3.14, &min, &max );
157+ // min = 3.14, max = 4.2
156158
157- out = stdlib_base_minmax( 0.0 , -0.0 );
158- // returns [ -0.0, 0.0 ]
159+ stdlib_base_minmax( 0.0, -0.0, &min, &max );
160+ // min = -0.0, max = 0.0
159161```
160162
161163The function accepts the following arguments:
@@ -164,7 +166,7 @@ The function accepts the following arguments:
164166- **y**: `[in] double` input value.
165167
166168```c
167- double stdlib_base_minmax ( const double x, const double y );
169+ double stdlib_base_minmax( const double x, const double y, double* min, double* max );
168170```
169171
170172</section >
@@ -193,14 +195,15 @@ double stdlib_base_minmax( const double x, const double y );
193195int main ( void ) {
194196 double x;
195197 double y;
196- double v;
198+ double min;
199+ double max;
197200 int i;
198201
199202 for ( i = 0; i < 100; i++ ) {
200203 x = ( ( (double)rand() / (double)RAND_MAX ) * 200.0 ) - 100.0;
201204 y = ( ( (double)rand() / (double)RAND_MAX ) * 200.0 ) - 100.0;
202- v = stdlib_base_minmax( x, y );
203- printf( "x: %lf, y: %lf, minmax(x, y): [ %lf, %lf ]\n", x, y, v[0], v[1] );
205+ stdlib_base_minmax( x, y, &min, &max );
206+ printf( "x: %lf, y: %lf, minmax(x, y): [ %lf, %lf ] \n", x, y, min, max );
204207 }
205208}
206209```
0 commit comments