nanminf
Return the minimum value of two single-precision floating-point numbers, ignoring NaN.
Usage
var nanminf = require( '@stdlib/math/base/special/nanminf' );
nanminf( x, y )
Returns the minimum value of two single-precision floating-point numbers, ignoring NaN.
var v = nanminf( 4.2, 3.14 );
// returns 3.14
v = nanminf( +0.0, -0.0 );
// returns -0.0
If any argument is NaN
, the function returns the other operand.
var v = nanminf( 4.2, NaN );
// returns 4.2
v = nanminf( NaN, 3.14 );
// returns 3.14
If both arguments are NaN
, the function returns NaN
.
var v = nanminf( NaN, NaN );
// returns NaN
Examples
var nanminf = require( '@stdlib/math/base/special/nanminf' );
var m = nanminf( 3.0, 4.0 );
console.log( m );
// => 3.0
m = nanminf( NaN, 4.0 );
console.log( m );
// => 4.0
m = nanminf( 4.0, NaN );
console.log( m );
// => 4.0
m = nanminf( NaN, NaN );
console.log( m );
// => NaN
C APIs
Usage
#include "stdlib/math/base/special/nanminf.h"
stdlib_base_nanminf( x, y )
Returns the minimum value of two single-precision floating-point numbers, ignoring NaN.
float out = stdlib_base_nanminf( 4.2f, 3.14f );
// returns 3.14f
out = stdlib_base_nanminf( 4.14f, 0.0f / 0.0f );
// returns 4.14f
The function accepts the following arguments:
- x:
[in] float
input value. - y:
[in] float
input value.
float stdlib_base_nanminf( const float x, const float y );
Examples
#include "stdlib/math/base/special/nanminf.h"
#include <stdio.h>
int main( void ) {
const float x[] = { 1.0f, 0.45f, -0.89f, 0.0f / 0.0f, -0.78f, -0.22f, 0.66f, 0.11f, -0.55f, 0.0f };
const float y[] = { -0.22f, 0.66f, 0.0f, -0.55f, 0.33f, 1.0f, 0.0f / 0.0f, 0.11f, 0.45f, -0.78f };
float v;
int i;
for ( i = 0; i < 10; i++ ) {
v = stdlib_base_nanminf( x[ i ], y[ i ] );
printf( "x[ %d ]: %f, y[ %d ]: %f, nanminf( x[ %d ], y[ %d ] ): %f\n", i, x[ i ], i, y[ i ], i, i, v );
}
}