diff --git a/.editorconfig b/.editorconfig
index 60d743f..dab5d2a 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -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}]
@@ -121,7 +120,7 @@ indent_style = tab
[*.{md,md.txt}]
indent_style = space
indent_size = 4
-trim_trailing_whitespace = false
+trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim.
# Set properties for `usage.txt` files:
[usage.txt]
diff --git a/.github/.keepalive b/.github/.keepalive
deleted file mode 100644
index 2bc6410..0000000
--- a/.github/.keepalive
+++ /dev/null
@@ -1 +0,0 @@
-2024-12-01T04:50:52.782Z
diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml
index 5ed8195..cb18633 100644
--- a/.github/workflows/test_install.yml
+++ b/.github/workflows/test_install.yml
@@ -50,8 +50,8 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- # Run workflow job if `publish` workflow run is successful or when the workflow is manually run:
- if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
+ # Run workflow job if `publish` workflow run is successful or when the workflow is manually triggered or on a schedule:
+ if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }}
# Define the sequence of job steps...
steps:
diff --git a/.github/workflows/test_published_package.yml b/.github/workflows/test_published_package.yml
index 67934e8..25479ef 100644
--- a/.github/workflows/test_published_package.yml
+++ b/.github/workflows/test_published_package.yml
@@ -47,8 +47,8 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- # Run workflow job if `publish` workflow run is successful or when the workflow is manually run:
- if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
+ # Run workflow job if `publish` workflow run is successful or when the workflow is manually triggered or on a schedule:
+ if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }}
# Define the job's steps:
steps:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3fe678a..3dc146b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,7 @@
-## Unreleased (2024-12-01)
+## Unreleased (2025-01-17)
@@ -12,6 +12,7 @@
+- [`0900838`](https://github.com/stdlib-js/stdlib/commit/090083855a65254591477cb58966d7b232f3c365) - **refactor:** update `math/base/special/hypot` to follow latest project conventions [(#4765)](https://github.com/stdlib-js/stdlib/pull/4765) _(by Vivek Maurya, Athan Reines)_
- [`9e689ff`](https://github.com/stdlib-js/stdlib/commit/9e689ffcb7c6223afc521f1e574b42f10921cf5e) - **chore:** fix indentation in manifest.json files _(by Philipp Burckhardt)_
@@ -24,9 +25,11 @@
### Contributors
-A total of 1 person contributed to this release. Thank you to this contributor:
+A total of 3 people contributed to this release. Thank you to the following contributors:
+- Athan Reines
- Philipp Burckhardt
+- Vivek Maurya
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index a8d0bb6..92d7552 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -2,11 +2,14 @@
#
# Contributors listed in alphabetical order.
+Aadish Jain
Aayush Khanna
Abhijit Raut
Adarsh Palaskar
Aditya Sapra
-AgPriyanshu18 <113460573+AgPriyanshu18@users.noreply.github.com>
+Ahmed Atwa
+Ahmed Kashkoush
+Ahmed Khaled
Aleksandr <112382387+alextes90@users.noreply.github.com>
Ali Salesi
Aman Bhansali
@@ -23,6 +26,9 @@ Dan Rose
Daniel Killenberger
Daniel Yu <40680511+Daniel777y@users.noreply.github.com>
Debashis Maharana
+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
Dorrin Sotoudeh
@@ -44,13 +50,14 @@ Joey Reed
Jordan Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com>
Joris Labie
Justin Dennison
+Karan Anand <119553199+anandkaranubc@users.noreply.github.com>
Karthik Prakash <116057817+skoriop@users.noreply.github.com>
-Khaldon
Kohantika Nath <145763549+kohantikanath@users.noreply.github.com>
Krishnendu Das <86651039+itskdhere@users.noreply.github.com>
Kshitij-Dale <152467202+Kshitij-Dale@users.noreply.github.com>
-Lovelin <100030865+lovelindhoni@users.noreply.github.com>
+Lovelin Dhoni J B <100030865+lovelindhoni@users.noreply.github.com>
Manik Sharma
+Manvith M <148960168+manvith2003@users.noreply.github.com>
Marcus Fantham
Matt Cochrane
Mihir Pandit <129577900+MSP20086@users.noreply.github.com>
@@ -59,37 +66,41 @@ Mohammad Kaif
Momtchil Momtchev
Muhammad Haris
Naresh Jagadeesan
+Naveen Kumar
Neeraj Pathak
-NightKnight
+Nishant Shinde <97207366+nishant-s7@users.noreply.github.com>
Nithin Katta <88046362+nithinkatta@users.noreply.github.com>
Nourhan Hasan <109472010+TheNourhan@users.noreply.github.com>
Ognjen Jevremović
Oneday12323 <107678750+Oneday12323@users.noreply.github.com>
+Ori Miles <97595296+orimiles5@users.noreply.github.com>
Philipp Burckhardt
Prajwal Kulkarni
Pranav Goswami
-Praneki <97080887+PraneGIT@users.noreply.github.com>
-Pratik <97464067+Pratik772846@users.noreply.github.com>
+Pranjal Jha <97080887+PraneGIT@users.noreply.github.com>
+Prashant Kumar Yadav <144602492+0PrashantYadav0@users.noreply.github.com>
+Pratik Singh <97464067+Pratik772846@users.noreply.github.com>
Pratyush Kumar Chouhan
-Priyansh <88396544+itsspriyansh@users.noreply.github.com>
+Priyansh Prajapati <88396544+itsspriyansh@users.noreply.github.com>
+Priyanshu Agarwal <113460573+AgPriyanshu18@users.noreply.github.com>
Pushpendra Chandravanshi
-RISHAV <115060907+rishav2404@users.noreply.github.com>
Raunak Kumar Gupta
Rejoan Sardar <119718513+Rejoan-Sardar@users.noreply.github.com>
Ricky Reusser
Ridam Garg <67867319+RidamGarg@users.noreply.github.com>
+Rishav <115060907+rishav2404@users.noreply.github.com>
Robert Gislason
Roman Stetsyk <25715951+romanstetsyk@users.noreply.github.com>
-Rutam <138517416+performant23@users.noreply.github.com>
+Rutam Kathale <138517416+performant23@users.noreply.github.com>
Ruthwik Chikoti <145591715+ruthwikchikoti@users.noreply.github.com>
Ryan Seal
Rylan Yang <137365285+rylany27@users.noreply.github.com>
Sai Srikar Dumpeti <80447788+the-r3aper7@users.noreply.github.com>
-SarthakPaandey <145528240+SarthakPaandey@users.noreply.github.com>
+Sarthak Paandey <145528240+SarthakPaandey@users.noreply.github.com>
Saurabh Singh
Seyyed Parsa Neshaei
Shashank Shekhar Singh
-Shivam <11shivam00@gmail.com>
+Shivam Ahir <11shivam00@gmail.com>
Shraddheya Shendre
Shubh Mehta <93862397+Shubh942@users.noreply.github.com>
Shubham Mishra
@@ -98,7 +109,7 @@ Snehil Shah
Soumajit Chatterjee <121816890+soumajit23@users.noreply.github.com>
Spandan Barve
Stephannie Jiménez Gacha
-Suraj kumar <125961509+kumarsuraj212003@users.noreply.github.com>
+Suraj Kumar <125961509+kumarsuraj212003@users.noreply.github.com>
Tirtadwipa Manunggal
Tudor Pagu <104032457+tudor-pagu@users.noreply.github.com>
Tufailahmed Bargir <142114244+Tufailahmed-Bargir@users.noreply.github.com>
@@ -108,12 +119,10 @@ UtkershBasnet <119008923+UtkershBasnet@users.noreply.github.com>
Vaibhav Patel <98279986+noobCoderVP@users.noreply.github.com>
Varad Gupta
Vinit Pandit <106718914+MeastroZI@users.noreply.github.com>
+Vivek Maurya
Xiaochuan Ye
+Yaswanth Kosuru <116426380+yaswanthkosuru@users.noreply.github.com>
Yernar Yergaziyev
-naveen
-nishant-s7 <97207366+nishant-s7@users.noreply.github.com>
olenkabilonizhka <62379231+olenkabilonizhka@users.noreply.github.com>
-orimiles5 <97595296+orimiles5@users.noreply.github.com>
rainn <88160429+AmCodesLame@users.noreply.github.com>
rei2hu
-yaswanth <116426380+yaswanthkosuru@users.noreply.github.com>
diff --git a/NOTICE b/NOTICE
index e6e7482..cbd3a29 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1 +1 @@
-Copyright (c) 2016-2024 The Stdlib Authors.
+Copyright (c) 2016-2025 The Stdlib Authors.
diff --git a/README.md b/README.md
index 5c7ef56..68a8216 100644
--- a/README.md
+++ b/README.md
@@ -152,20 +152,16 @@ h = hypot( 5.0, NaN );
```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 hypot = require( '@stdlib/math-base-special-hypot' );
-var x;
-var y;
-var h;
-var i;
+var len = 100;
+var x = discreteUniform( len, -50, 50 );
+var y = discreteUniform( len, -50, 50 );
-for ( i = 0; i < 100; i++ ) {
- x = round( randu()*100.0 ) - 50.0;
- y = round( randu()*100.0 ) - 50.0;
- h = hypot( 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 ], hypot( x[ i ], y[ i ] ) );
}
```
@@ -301,7 +297,7 @@ See [LICENSE][stdlib-license].
## Copyright
-Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
+Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors].
diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js
index 801b15d..9734372 100644
--- a/benchmark/benchmark.js
+++ b/benchmark/benchmark.js
@@ -21,8 +21,8 @@
// MODULES //
var bench = require( '@stdlib/bench-harness' );
-var randu = require( '@stdlib/random-base-randu' );
var isnan = require( '@stdlib/math-base-assert-is-nan' );
+var uniform = require( '@stdlib/random-array-uniform' );
var pkg = require( './../package.json' ).name;
var hypot = require( './../lib' );
@@ -37,16 +37,19 @@ var opts = {
// MAIN //
bench( pkg, function benchmark( b ) {
+ var len;
var x;
var y;
var z;
var i;
+ len = 100;
+ x = uniform( len, -50, 50 );
+ y = uniform( len, -50, 50 );
+
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
- x = ( randu()*100.0 ) - 50.0;
- y = ( randu()*100.0 ) - 50.0;
- z = hypot( x, y );
+ z = hypot( x[ i % len ], y[ i % len ] );
if ( isnan( z ) ) {
b.fail( 'should not return NaN' );
}
@@ -60,16 +63,19 @@ bench( pkg, function benchmark( b ) {
});
bench( pkg+'::built-in', opts, function benchmark( b ) {
+ var len;
var x;
var y;
var z;
var i;
+ len = 100;
+ x = uniform( len, -50, 50 );
+ y = uniform( len, -50, 50 );
+
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 ( isnan( z ) ) {
b.fail( 'should not return NaN' );
}
diff --git a/benchmark/benchmark.native.js b/benchmark/benchmark.native.js
index a162b10..121e402 100644
--- a/benchmark/benchmark.native.js
+++ b/benchmark/benchmark.native.js
@@ -22,8 +22,8 @@
var resolve = require( 'path' ).resolve;
var bench = require( '@stdlib/bench-harness' );
-var randu = require( '@stdlib/random-base-randu' );
var isnan = require( '@stdlib/math-base-assert-is-nan' );
+var uniform = require( '@stdlib/random-array-uniform' );
var tryRequire = require( '@stdlib/utils-try-require' );
var pkg = require( './../package.json' ).name;
@@ -39,16 +39,19 @@ var opts = {
// MAIN //
bench( pkg+'::native', opts, function benchmark( b ) {
+ var len;
var x;
var y;
var z;
var i;
+ len = 100;
+ x = uniform( len, -50, 50 );
+ y = uniform( len, -50, 50 );
+
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
- x = ( randu()*100.0 ) - 50.0;
- y = ( randu()*100.0 ) - 50.0;
- z = hypot( x, y );
+ z = hypot( x[ i % len ], y[ i % len ] );
if ( isnan( z ) ) {
b.fail( 'should not return NaN' );
}
diff --git a/benchmark/c/native/benchmark.c b/benchmark/c/native/benchmark.c
index ac9a91e..4355b03 100644
--- a/benchmark/c/native/benchmark.c
+++ b/benchmark/c/native/benchmark.c
@@ -91,17 +91,20 @@ static double rand_double( void ) {
*/
static double benchmark( void ) {
double elapsed;
- double x;
- double y;
+ double x[ 100 ];
+ double y[ 100 ];
double z;
double t;
int i;
+ for ( i = 0; i < 100; i++ ) {
+ x[ i ] = ( rand_double() * 100.0 ) - 50.0;
+ y[ i ] = ( rand_double() * 100.0 ) - 50.0;
+ }
+
t = tic();
for ( i = 0; i < ITERATIONS; i++ ) {
- x = ( 100.0*rand_double() ) - 50.0;
- y = ( 100.0*rand_double() ) - 50.0;
- z = stdlib_base_hypot( x, y );
+ z = stdlib_base_hypot( x[ i % 100 ], y[ i % 100 ] );
if ( z != z ) {
printf( "should not return NaN\n" );
break;
diff --git a/examples/index.js b/examples/index.js
index 8c9ad69..3b0a169 100644
--- a/examples/index.js
+++ b/examples/index.js
@@ -18,18 +18,14 @@
'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 hypot = require( './../lib' );
-var x;
-var y;
-var h;
-var i;
+var len = 100;
+var x = discreteUniform( len, -50, 50 );
+var y = discreteUniform( len, -50, 50 );
-for ( i = 0; i < 100; i++ ) {
- x = round( randu()*100.0 ) - 50.0;
- y = round( randu()*100.0 ) - 50.0;
- h = hypot( 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 ], hypot( x[ i ], y[ i ] ) );
}
diff --git a/manifest.json b/manifest.json
index 6e1c54c..7b82ddd 100644
--- a/manifest.json
+++ b/manifest.json
@@ -28,7 +28,7 @@
{
"task": "build",
"src": [
- "./src/hypot.c"
+ "./src/main.c"
],
"include": [
"./include"
@@ -41,13 +41,14 @@
"@stdlib/math-base-napi-binary",
"@stdlib/math-base-assert-is-nan",
"@stdlib/math-base-assert-is-infinite",
- "@stdlib/math-base-special-sqrt"
+ "@stdlib/math-base-special-sqrt",
+ "@stdlib/constants-float64-pinf"
]
},
{
"task": "benchmark",
"src": [
- "./src/hypot.c"
+ "./src/main.c"
],
"include": [
"./include"
@@ -59,13 +60,14 @@
"dependencies": [
"@stdlib/math-base-assert-is-nan",
"@stdlib/math-base-assert-is-infinite",
- "@stdlib/math-base-special-sqrt"
+ "@stdlib/math-base-special-sqrt",
+ "@stdlib/constants-float64-pinf"
]
},
{
"task": "examples",
"src": [
- "./src/hypot.c"
+ "./src/main.c"
],
"include": [
"./include"
@@ -77,7 +79,8 @@
"dependencies": [
"@stdlib/math-base-assert-is-nan",
"@stdlib/math-base-assert-is-infinite",
- "@stdlib/math-base-special-sqrt"
+ "@stdlib/math-base-special-sqrt",
+ "@stdlib/constants-float64-pinf"
]
}
]
diff --git a/package.json b/package.json
index cc8d665..754c7ad 100644
--- a/package.json
+++ b/package.json
@@ -53,8 +53,8 @@
"@stdlib/math-base-assert-is-positive-zero": "^0.2.2",
"@stdlib/math-base-special-abs": "^0.2.2",
"@stdlib/math-base-special-pow": "^0.3.0",
- "@stdlib/math-base-special-round": "^0.3.0",
- "@stdlib/random-base-randu": "^0.2.1",
+ "@stdlib/random-array-discrete-uniform": "^0.2.1",
+ "@stdlib/random-array-uniform": "^0.2.1",
"@stdlib/utils-try-require": "^0.2.2",
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
"istanbul": "^0.4.1",
diff --git a/src/hypot.c b/src/main.c
similarity index 91%
rename from src/hypot.c
rename to src/main.c
index 58a77e9..11ba026 100644
--- a/src/hypot.c
+++ b/src/main.c
@@ -20,7 +20,7 @@
#include "stdlib/math/base/assert/is_nan.h"
#include "stdlib/math/base/assert/is_infinite.h"
#include "stdlib/math/base/special/sqrt.h"
-#include
+#include "stdlib/constants/float64/pinf.h"
/**
* Computes the hypotenuse avoiding overflow and underflow.
@@ -41,7 +41,7 @@ double stdlib_base_hypot( const double x, const double y ) {
return 0.0 / 0.0; // NaN
}
if ( stdlib_base_is_infinite( x ) || stdlib_base_is_infinite( y ) ) {
- return HUGE_VAL;
+ return STDLIB_CONSTANT_FLOAT64_PINF;
}
a = x;
b = y;
@@ -60,5 +60,5 @@ double stdlib_base_hypot( const double x, const double y ) {
return 0.0;
}
b /= a;
- return a * stdlib_base_sqrt( 1.0 + (b*b) );
+ return a * stdlib_base_sqrt( 1.0 + ( b * b ) );
}
diff --git a/test/test.js b/test/test.js
index eb153b8..64eaf8f 100644
--- a/test/test.js
+++ b/test/test.js
@@ -49,28 +49,28 @@ tape( 'the function returns `+infinity` if either argument is `+-infinity`', fun
var h;
h = hypot( PINF, 3.14 );
- t.strictEqual( h, PINF, 'returns +infinity' );
+ t.strictEqual( h, PINF, 'returns expected value' );
h = hypot( 3.14, PINF );
- t.strictEqual( h, PINF, 'returns +infinity' );
+ t.strictEqual( h, PINF, 'returns expected value' );
h = hypot( NINF, 3.14 );
- t.strictEqual( h, PINF, 'returns +infinity' );
+ t.strictEqual( h, PINF, 'returns expected value' );
h = hypot( 3.14, NINF );
- t.strictEqual( h, PINF, 'returns +infinity' );
+ t.strictEqual( h, PINF, 'returns expected value' );
h = hypot( PINF, PINF );
- t.strictEqual( h, PINF, 'returns +infinity' );
+ t.strictEqual( h, PINF, 'returns expected value' );
h = hypot( NINF, PINF );
- t.strictEqual( h, PINF, 'returns +infinity' );
+ t.strictEqual( h, PINF, 'returns expected value' );
h = hypot( PINF, NINF );
- t.strictEqual( h, PINF, 'returns +infinity' );
+ t.strictEqual( h, PINF, 'returns expected value' );
h = hypot( NINF, NINF );
- t.strictEqual( h, PINF, 'returns +infinity' );
+ t.strictEqual( h, PINF, 'returns expected value' );
t.end();
});
@@ -79,13 +79,13 @@ tape( 'the function returns `NaN` if either argument is `NaN`', function test( t
var h;
h = hypot( NaN, 3.14 );
- t.strictEqual( isnan( h ), true, 'returns NaN' );
+ t.strictEqual( isnan( h ), true, 'returns expected value' );
h = hypot( 3.14, NaN );
- t.strictEqual( isnan( h ), true, 'returns NaN' );
+ t.strictEqual( isnan( h ), true, 'returns expected value' );
h = hypot( NaN, NaN );
- t.strictEqual( isnan( h ), true, 'returns NaN' );
+ t.strictEqual( isnan( h ), true, 'returns expected value' );
t.end();
});
@@ -94,16 +94,16 @@ tape( 'the function returns `+0` if both arguments are `+-0`', function test( t
var h;
h = hypot( +0.0, +0.0 );
- t.strictEqual( isPositiveZero( h ), true, 'returns +0' );
+ t.strictEqual( isPositiveZero( h ), true, 'returns expected value' );
h = hypot( -0.0, +0.0 );
- t.strictEqual( isPositiveZero( h ), true, 'returns +0' );
+ t.strictEqual( isPositiveZero( h ), true, 'returns expected value' );
h = hypot( +0.0, -0.0 );
- t.strictEqual( isPositiveZero( h ), true, 'returns +0' );
+ t.strictEqual( isPositiveZero( h ), true, 'returns expected value' );
h = hypot( -0.0, -0.0 );
- t.strictEqual( isPositiveZero( h ), true, 'returns +0' );
+ t.strictEqual( isPositiveZero( h ), true, 'returns expected value' );
t.end();
});
@@ -138,13 +138,13 @@ tape( 'the function computes the hypotenuse (canonical inputs)', function test(
var h;
h = hypot( 3.0, 4.0 );
- t.strictEqual( h, 5.0, 'returns 5.0' );
+ t.strictEqual( h, 5.0, 'returns expected value' );
h = hypot( 6.0, 8.0 );
- t.strictEqual( h, 10.0, 'returns 10.0' );
+ t.strictEqual( h, 10.0, 'returns expected value' );
h = hypot( 5.0, 12.0 );
- t.strictEqual( h, 13.0, 'returns 13.0' );
+ t.strictEqual( h, 13.0, 'returns expected value' );
t.end();
});
@@ -153,7 +153,7 @@ tape( 'the function avoids overflow', function test( t ) {
var h;
h = sqrt( pow( 1.0e308, 2 ) + pow( 1.0e308, 2 ) );
- t.strictEqual( h, PINF, 'returns +infinity' );
+ t.strictEqual( h, PINF, 'returns expected value' );
h = hypot( 1.0e308, 1.0e308 );
t.strictEqual( h, 1.4142135623730951e308, 'avoids overflow' );
diff --git a/test/test.native.js b/test/test.native.js
index 2e09411..c75d13f 100644
--- a/test/test.native.js
+++ b/test/test.native.js
@@ -58,28 +58,28 @@ tape( 'the function returns `+infinity` if either argument is `+-infinity`', opt
var h;
h = hypot( PINF, 3.14 );
- t.strictEqual( h, PINF, 'returns +infinity' );
+ t.strictEqual( h, PINF, 'returns expected value' );
h = hypot( 3.14, PINF );
- t.strictEqual( h, PINF, 'returns +infinity' );
+ t.strictEqual( h, PINF, 'returns expected value' );
h = hypot( NINF, 3.14 );
- t.strictEqual( h, PINF, 'returns +infinity' );
+ t.strictEqual( h, PINF, 'returns expected value' );
h = hypot( 3.14, NINF );
- t.strictEqual( h, PINF, 'returns +infinity' );
+ t.strictEqual( h, PINF, 'returns expected value' );
h = hypot( PINF, PINF );
- t.strictEqual( h, PINF, 'returns +infinity' );
+ t.strictEqual( h, PINF, 'returns expected value' );
h = hypot( NINF, PINF );
- t.strictEqual( h, PINF, 'returns +infinity' );
+ t.strictEqual( h, PINF, 'returns expected value' );
h = hypot( PINF, NINF );
- t.strictEqual( h, PINF, 'returns +infinity' );
+ t.strictEqual( h, PINF, 'returns expected value' );
h = hypot( NINF, NINF );
- t.strictEqual( h, PINF, 'returns +infinity' );
+ t.strictEqual( h, PINF, 'returns expected value' );
t.end();
});
@@ -88,13 +88,13 @@ tape( 'the function returns `NaN` if either argument is `NaN`', opts, function t
var h;
h = hypot( NaN, 3.14 );
- t.strictEqual( isnan( h ), true, 'returns NaN' );
+ t.strictEqual( isnan( h ), true, 'returns expected value' );
h = hypot( 3.14, NaN );
- t.strictEqual( isnan( h ), true, 'returns NaN' );
+ t.strictEqual( isnan( h ), true, 'returns expected value' );
h = hypot( NaN, NaN );
- t.strictEqual( isnan( h ), true, 'returns NaN' );
+ t.strictEqual( isnan( h ), true, 'returns expected value' );
t.end();
});
@@ -103,16 +103,16 @@ tape( 'the function returns `+0` if both arguments are `+-0`', opts, function te
var h;
h = hypot( +0.0, +0.0 );
- t.strictEqual( isPositiveZero( h ), true, 'returns +0' );
+ t.strictEqual( isPositiveZero( h ), true, 'returns expected value' );
h = hypot( -0.0, +0.0 );
- t.strictEqual( isPositiveZero( h ), true, 'returns +0' );
+ t.strictEqual( isPositiveZero( h ), true, 'returns expected value' );
h = hypot( +0.0, -0.0 );
- t.strictEqual( isPositiveZero( h ), true, 'returns +0' );
+ t.strictEqual( isPositiveZero( h ), true, 'returns expected value' );
h = hypot( -0.0, -0.0 );
- t.strictEqual( isPositiveZero( h ), true, 'returns +0' );
+ t.strictEqual( isPositiveZero( h ), true, 'returns expected value' );
t.end();
});
@@ -147,13 +147,13 @@ tape( 'the function computes the hypotenuse (canonical inputs)', opts, function
var h;
h = hypot( 3.0, 4.0 );
- t.strictEqual( h, 5.0, 'returns 5.0' );
+ t.strictEqual( h, 5.0, 'returns expected value' );
h = hypot( 6.0, 8.0 );
- t.strictEqual( h, 10.0, 'returns 10.0' );
+ t.strictEqual( h, 10.0, 'returns expected value' );
h = hypot( 5.0, 12.0 );
- t.strictEqual( h, 13.0, 'returns 13.0' );
+ t.strictEqual( h, 13.0, 'returns expected value' );
t.end();
});
@@ -162,7 +162,7 @@ tape( 'the function avoids overflow', opts, function test( t ) {
var h;
h = sqrt( pow( 1.0e308, 2 ) + pow( 1.0e308, 2 ) );
- t.strictEqual( h, PINF, 'returns +infinity' );
+ t.strictEqual( h, PINF, 'returns expected value' );
h = hypot( 1.0e308, 1.0e308 );
t.strictEqual( h, 1.4142135623730951e308, 'avoids overflow' );