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 Jan 17, 2025
1 parent d862029 commit a82874a
Show file tree
Hide file tree
Showing 15 changed files with 236 additions and 173 deletions.
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ indent_style = tab
[*.{f,f.txt}]
indent_style = space
indent_size = 2
insert_final_newline = false

# Set properties for shell files:
[*.{sh,sh.txt}]
Expand Down
1 change: 0 additions & 1 deletion .github/.keepalive

This file was deleted.

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

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

## Unreleased (2025-01-17)

<section class="commits">

### Commits

<details>

- [`e91af13`](https://github.com/stdlib-js/stdlib/commit/e91af13bf35384d0ee1163fe3074c79f1a01bc72) - **refactor:** update `math/base/special/hypotf` to follow latest project conventions [(#4783)](https://github.com/stdlib-js/stdlib/pull/4783) _(by Vivek Maurya, 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
- Vivek Maurya

</section>

<!-- /.contributors -->

</section>

<!-- /.release -->

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

## 0.2.2 (2024-07-28)
Expand Down
4 changes: 3 additions & 1 deletion CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Daniel Killenberger <daniel.killenberger@gmail.com>
Daniel Yu <40680511+Daniel777y@users.noreply.github.com>
Debashis Maharana <debashismaharana7854@gmail.com>
Desh Deepak Kant <118960904+DeshDeepakKant@users.noreply.github.com>
Dhruv Arvind Singh <154677013+DhruvArvindSingh@users.noreply.github.com>
Divyansh Seth <59174836+sethdivyansh@users.noreply.github.com>
Dominic Lim <46486515+domlimm@users.noreply.github.com>
Dominik Moritz <domoritz@gmail.com>
Expand All @@ -49,6 +50,7 @@ Joey Reed <joeyrreed@gmail.com>
Jordan Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com>
Joris Labie <joris.labie1@gmail.com>
Justin Dennison <justin1dennison@gmail.com>
Karan Anand <119553199+anandkaranubc@users.noreply.github.com>
Karthik Prakash <116057817+skoriop@users.noreply.github.com>
Kohantika Nath <145763549+kohantikanath@users.noreply.github.com>
Krishnendu Das <86651039+itskdhere@users.noreply.github.com>
Expand Down Expand Up @@ -117,7 +119,7 @@ UtkershBasnet <119008923+UtkershBasnet@users.noreply.github.com>
Vaibhav Patel <98279986+noobCoderVP@users.noreply.github.com>
Varad Gupta <varadgupta21@gmail.com>
Vinit Pandit <106718914+MeastroZI@users.noreply.github.com>
Vivek maurya <155618190+vivekmaurya001@users.noreply.github.com>
Vivek Maurya <vm8118134@gmail.com>
Xiaochuan Ye <tap91624@gmail.com>
Yaswanth Kosuru <116426380+yaswanthkosuru@users.noreply.github.com>
Yernar Yergaziyev <yernar.yergaziyev@erg.kz>
Expand Down
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Copyright (c) 2016-2024 The Stdlib Authors.
Copyright (c) 2016-2025 The Stdlib Authors.
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,19 @@ h = hypotf( 5.0, NaN );
<!-- eslint no-undef: "error" -->

```javascript
var randu = require( '@stdlib/random-base-randu' );
var round = require( '@stdlib/math-base-special-round' );
var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
var hypotf = require( '@stdlib/math-base-special-hypotf' );

var x;
var y;
var h;
var i;
var len = 100;
var opts = {
'dtype': 'float32'
};
var x = discreteUniform( len, -50, 50, opts );
var y = discreteUniform( len, -50, 50, opts );

for ( i = 0; i < 100; i++ ) {
x = round( randu()*100.0 ) - 50.0;
y = round( randu()*100.0 ) - 50.0;
h = hypotf( x, y );
console.log( 'h(%d,%d) = %d', x, y, h );
var i;
for ( i = 0; i < len; i++ ) {
console.log( 'h(%d,%d) = %d', x[ i ], y[ i ], hypotf( x[ i ], y[ i ] ) );
}
```

Expand Down Expand Up @@ -271,7 +270,7 @@ See [LICENSE][stdlib-license].
## Copyright
Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
Copyright &copy; 2016-2025. The Stdlib [Authors][stdlib-authors].
</section>
Expand Down
30 changes: 23 additions & 7 deletions benchmark/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// MODULES //

var bench = require( '@stdlib/bench-harness' );
var randu = require( '@stdlib/random-base-randu' );
var uniform = require( '@stdlib/random-array-uniform' );
var isnanf = require( '@stdlib/math-base-assert-is-nanf' );
var pkg = require( './../package.json' ).name;
var hypotf = require( './../lib' );
Expand All @@ -37,16 +37,24 @@ var opts = {
// MAIN //

bench( pkg, function benchmark( b ) {
var opts;
var len;
var x;
var y;
var z;
var i;

opts = {
'dtype': 'float32'
};

len = 100;
x = uniform( len, -50, 50, opts );
y = uniform( len, -50, 50, opts );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = ( randu()*100.0 ) - 50.0;
y = ( randu()*100.0 ) - 50.0;
z = hypotf( x, y );
z = hypotf( x[ i % len ], y[ i % len ] );
if ( isnanf( z ) ) {
b.fail( 'should not return NaN' );
}
Expand All @@ -60,16 +68,24 @@ bench( pkg, function benchmark( b ) {
});

bench( pkg+'::built-in', opts, function benchmark( b ) {
var opts;
var len;
var x;
var y;
var z;
var i;

opts = {
'dtype': 'float32'
};

len = 100;
x = uniform( len, -50, 50, opts );
y = uniform( len, -50, 50, opts );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = ( randu()*100.0 ) - 50.0;
y = ( randu()*100.0 ) - 50.0;
z = Math.hypot( x, y ); // eslint-disable-line stdlib/no-builtin-math
z = Math.hypot( x[ i % len ], y[ i % len ] ); // eslint-disable-line stdlib/no-builtin-math
if ( isnanf( z ) ) {
b.fail( 'should not return NaN' );
}
Expand Down
16 changes: 12 additions & 4 deletions benchmark/benchmark.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

var resolve = require( 'path' ).resolve;
var bench = require( '@stdlib/bench-harness' );
var randu = require( '@stdlib/random-base-randu' );
var uniform = require( '@stdlib/random-array-uniform' );
var isnanf = require( '@stdlib/math-base-assert-is-nanf' );
var tryRequire = require( '@stdlib/utils-try-require' );
var pkg = require( './../package.json' ).name;
Expand All @@ -39,16 +39,24 @@ var opts = {
// MAIN //

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

opts = {
'dtype': 'float32'
};

len = 100;
x = uniform( len, -50, 50, opts );
y = uniform( len, -50, 50, opts );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = ( randu()*100.0 ) - 50.0;
y = ( randu()*100.0 ) - 50.0;
z = hypotf( x, y );
z = hypotf( x[ i % len ], y[ i % len ] );
if ( isnanf( z ) ) {
b.fail( 'should not return NaN' );
}
Expand Down
13 changes: 8 additions & 5 deletions benchmark/c/native/benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,19 @@ static float rand_float( void ) {
static double benchmark( void ) {
double elapsed;
double t;
float x;
float y;
float x[ 100 ];
float y[ 100 ];
float z;
int i;

for ( i = 0; i < 100; i++ ) {
x[ i ] = ( 100.0f * rand_float() ) - 50.0f;
y[ i ] = ( 100.0f * rand_float() ) - 50.0f;
}

t = tic();
for ( i = 0; i < ITERATIONS; i++ ) {
x = ( 100.0f*rand_float() ) - 50.0f;
y = ( 100.0f*rand_float() ) - 50.0f;
z = stdlib_base_hypotf( x, y );
z = stdlib_base_hypotf( x[ i % 100 ], y[ i % 100 ] );
if ( z != z ) {
printf( "should not return NaN\n" );
break;
Expand Down
21 changes: 10 additions & 11 deletions examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,17 @@

'use strict';

var randu = require( '@stdlib/random-base-randu' );
var round = require( '@stdlib/math-base-special-round' );
var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
var hypotf = require( './../lib' );

var x;
var y;
var h;
var i;
var len = 100;
var opts = {
'dtype': 'float32'
};
var x = discreteUniform( len, -50, 50, opts );
var y = discreteUniform( len, -50, 50, opts );

for ( i = 0; i < 100; i++ ) {
x = round( randu()*100.0 ) - 50.0;
y = round( randu()*100.0 ) - 50.0;
h = hypotf( x, y );
console.log( 'h(%d,%d) = %d', x, y, h );
var i;
for ( i = 0; i < len; i++ ) {
console.log( 'h(%d,%d) = %d', x[ i ], y[ i ], hypotf( x[ i ], y[ i ] ) );
}
Loading

0 comments on commit a82874a

Please sign in to comment.