Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Oct 19, 2024
1 parent 1abb2a1 commit ecf0cf9
Show file tree
Hide file tree
Showing 20 changed files with 1,308 additions and 7 deletions.
1 change: 0 additions & 1 deletion .github/.keepalive

This file was deleted.

45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,51 @@

> Package changelog.
<section class="release" id="unreleased">

## Unreleased (2024-10-19)

<section class="features">

### Features

- [`04b72af`](https://github.com/stdlib-js/stdlib/commit/04b72af273ca022bd8295379edc5ff04a03d23e7) - add C implementation for `math/base/special/nanmin` [(#3004)](https://github.com/stdlib-js/stdlib/pull/3004)

</section>

<!-- /.features -->

<section class="commits">

### Commits

<details>

- [`04b72af`](https://github.com/stdlib-js/stdlib/commit/04b72af273ca022bd8295379edc5ff04a03d23e7) - **feat:** add C implementation for `math/base/special/nanmin` [(#3004)](https://github.com/stdlib-js/stdlib/pull/3004) _(by Gunj Joshi, Athan Reines)_

</details>

</section>

<!-- /.commits -->

<section class="contributors">

### Contributors

A total of 2 people contributed to this release. Thank you to the following contributors:

- Athan Reines
- Gunj Joshi

</section>

<!-- /.contributors -->

</section>

<!-- /.release -->

<section class="release" id="v0.0.2">

## 0.0.2 (2024-07-28)
Expand Down
3 changes: 3 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ EuniceSim142 <[email protected]>
Frank Kovacs <[email protected]>
Golden Kumar <[email protected]>
Gunj Joshi <[email protected]>
Gururaj Gurram <[email protected]>
HarshaNP <[email protected]>
Harshita Kalani <[email protected]>
Hridyanshu <[email protected]>
Expand All @@ -44,6 +45,7 @@ Justin Dennison <[email protected]>
Kaif Mohd <[email protected]>
Karthik Prakash <[email protected]>
Khaldon <[email protected]>
Kohantika Nath <[email protected]>
Krishnendu Das <[email protected]>
Lovelin <[email protected]>
Manik Sharma <[email protected]>
Expand Down Expand Up @@ -94,6 +96,7 @@ Tudor Pagu <[email protected]>
Tufailahmed Bargir <[email protected]>
Utkarsh <http://[email protected]>
Utkarsh Raj <[email protected]>
UtkershBasnet <[email protected]>
Vaibhav Patel <[email protected]>
Varad Gupta <[email protected]>
Xiaochuan Ye <[email protected]>
Expand Down
124 changes: 124 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,130 @@ var v = nanmin( NaN, NaN );

</section>

<!-- /.notes -->

<!-- Package usage examples. -->

<section class="examples">

## Examples

<!-- eslint no-undef: "error" -->

```javascript
var nanmin = require( '@stdlib/math-base-special-nanmin' );

var m = nanmin( 3.0, 4.0 );
console.log( m );
// => 3.0

m = nanmin( NaN, 4.0 );
console.log( m );
// => 4.0

m = nanmin( 4.0, NaN );
console.log( m );
// => 4.0

m = nanmin( NaN, NaN );
console.log( m );
// => NaN
```

</section>

<!-- /.examples -->

<!-- C interface documentation. -->

* * *

<section class="c">

## C APIs

<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

<section class="intro">

</section>

<!-- /.intro -->

<!-- C usage documentation. -->

<section class="usage">

### Usage

```c
#include "stdlib/math/base/special/nanmin.h"
```

#### stdlib_base_nanmin( x, y )

Returns the minimum value, ignoring NaN.

```c
double out = stdlib_base_nanmin( 4.2, 3.14 );
// returns 3.14

out = stdlib_base_nanmin( 4.14, 0.0 / 0.0 );
// returns 4.14
```

The function accepts the following arguments:

- **x**: `[in] double` input value.
- **y**: `[in] double` input value.

```c
double stdlib_base_nanmin( const double x, const double y );
```
</section>
<!-- /.usage -->
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
<section class="notes">
</section>
<!-- /.notes -->
<!-- C API usage examples. -->
<section class="examples">
### Examples
```c
#include "stdlib/math/base/special/nanmin.h"
#include <stdio.h>
int main( void ) {
const double x[] = { 1.0, 0.45, -0.89, 0.0 / 0.0, -0.78, -0.22, 0.66, 0.11, -0.55, 0.0 };
const double y[] = { -0.22, 0.66, 0.0, -0.55, 0.33, 1.0, 0.0 / 0.0, 0.11, 0.45, -0.78 };
double v;
int i;
for ( i = 0; i < 10; i++ ) {
v = stdlib_base_nanmin( x[i], y[i] );
printf( "x[ %d ]: %f, y[ %d ]: %f, nanmin( x[ %d ], y[ %d ] ): %f\n", i, x[ i ], i, y[ i ], i, i, v );
}
}
```

</section>

<!-- /.examples -->

</section>

<!-- /.c -->

<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->

<section class="related">
Expand Down
64 changes: 64 additions & 0 deletions benchmark/benchmark.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2024 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var resolve = require( 'path' ).resolve;
var bench = require( '@stdlib/bench-harness' );
var isnan = require( '@stdlib/math-base-assert-is-nan' );
var tryRequire = require( '@stdlib/utils-try-require' );
var pkg = require( './../package.json' ).name;


// VARIABLES //

var nanmin = tryRequire( resolve( __dirname, './../lib/native.js' ) );
var opts = {
'skip': ( nanmin instanceof Error )
};


// MAIN //

bench( pkg+'::native', opts, function benchmark( b ) {
var values;
var x;
var y;
var z;
var i;

values = [ 3, 2, 2.0, 1.5, NaN ];
x = 0.4;

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
y = values[ i % values.length ];
z = nanmin( x, y );
if ( isnan( z ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( z ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});
Loading

0 comments on commit ecf0cf9

Please sign in to comment.