From 51c71e920c302545ba8c0132d73fa06bd760fd4e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 21 Nov 2024 08:16:43 +0000 Subject: [PATCH] Auto-generated commit --- CHANGELOG.md | 1 + base/special/csch/benchmark/benchmark.js | 7 +- .../csch/benchmark/benchmark.native.js | 7 +- .../csch/benchmark/c/native/benchmark.c | 9 ++- base/special/csch/src/Makefile | 64 +------------------ base/special/csch/test/test.js | 14 ++-- base/special/csch/test/test.native.js | 14 ++-- 7 files changed, 30 insertions(+), 86 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aaaf7daba..b6f1f1e1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -356,6 +356,7 @@ A total of 5 people contributed to this release. Thank you to the following cont
+- [`c660c70`](https://github.com/stdlib-js/stdlib/commit/c660c705bb3478f4fb6cb818c9b1d3429e8a6774) - **chore:** use correct `Makefile` and update benchmarks in `math/base/special/csch` [(#3209)](https://github.com/stdlib-js/stdlib/pull/3209) _(by Gunj Joshi)_ - [`b6a2b0b`](https://github.com/stdlib-js/stdlib/commit/b6a2b0b27dc8cc1e9fc02d9679a3ce468cf49b9d) - **docs:** update namespace table of contents [(#3192)](https://github.com/stdlib-js/stdlib/pull/3192) _(by stdlib-bot, Philipp Burckhardt)_ - [`961d039`](https://github.com/stdlib-js/stdlib/commit/961d03929b8b1b9c5221dc36cb21f0e8194f06c2) - **chore:** use relative path to load package.json file _(by Philipp Burckhardt)_ - [`15546a9`](https://github.com/stdlib-js/stdlib/commit/15546a92fb2f48b6c780fdf2dd0460340cda8830) - **docs:** update function name in header of C section _(by Philipp Burckhardt)_ diff --git a/base/special/csch/benchmark/benchmark.js b/base/special/csch/benchmark/benchmark.js index 6748e4177..40f494d9e 100644 --- a/base/special/csch/benchmark/benchmark.js +++ b/base/special/csch/benchmark/benchmark.js @@ -21,7 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var randu = require( '@stdlib/random/array/uniform' ); var isnan = require( './../../../../base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var csch = require( './../lib' ); @@ -34,10 +34,11 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = randu( 100, -5.0, 5.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*10.0 ) - 5.0; - y = csch( x ); + y = csch( x[ i % x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/base/special/csch/benchmark/benchmark.native.js b/base/special/csch/benchmark/benchmark.native.js index 5c62a934a..aa2efaf2f 100644 --- a/base/special/csch/benchmark/benchmark.native.js +++ b/base/special/csch/benchmark/benchmark.native.js @@ -22,7 +22,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var randu = require( '@stdlib/random/array/uniform' ); var isnan = require( './../../../../base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -43,10 +43,11 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var i; + x = randu( 100, -5.0, 5.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu() * 10.0 ) - 5.0; - y = csch( x ); + y = csch( x[ i % x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/base/special/csch/benchmark/c/native/benchmark.c b/base/special/csch/benchmark/c/native/benchmark.c index 80689f824..c959414ae 100644 --- a/base/special/csch/benchmark/c/native/benchmark.c +++ b/base/special/csch/benchmark/c/native/benchmark.c @@ -91,15 +91,18 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; + double x[ 100 ]; double y; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 10.0 * rand_double() ) - 5.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 10.0 * rand_double() ) - 5.0; - y = stdlib_base_csch( x ); + y = stdlib_base_csch( x[ i % 100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/base/special/csch/src/Makefile b/base/special/csch/src/Makefile index 8be96d0b0..bcf18aa46 100644 --- a/base/special/csch/src/Makefile +++ b/base/special/csch/src/Makefile @@ -1,3 +1,4 @@ +#/ # @license Apache-2.0 # # Copyright (c) 2024 The Stdlib Authors. @@ -45,69 +46,6 @@ endif endif -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean - 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. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - # RULES # #/ diff --git a/base/special/csch/test/test.js b/base/special/csch/test/test.js index 977746510..1c6b6cd31 100644 --- a/base/special/csch/test/test.js +++ b/base/special/csch/test/test.js @@ -171,31 +171,31 @@ tape( 'the function computes the hyperbolic cosecant (tiny positive)', function tape( 'the function returns `NaN` if provided a `NaN`', function test( t ) { var v = csch( NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `+Infinity` if provided `+0.0`', function test( t ) { var v = csch( +0.0 ); - t.equal( v, PINF, 'returns +Infinity' ); + t.equal( v, PINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `-Infinity` if provided `-0.0`', function test( t ) { var v = csch( -0.0 ); - t.equal( v, NINF, 'returns -Infinity' ); + t.equal( v, NINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `+0.0` if provided `+Infinity`', function test( t ) { var v = csch( PINF ); - t.equal( isPositiveZero(v), true, 'returns +0.0' ); + t.equal( isPositiveZero(v), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `-0.0` if provided `-Infinity`', function test( t ) { var v = csch( NINF ); - t.equal( isNegativeZero(v), true, 'returns -0.0' ); + t.equal( isNegativeZero(v), true, 'returns expected value' ); t.end(); }); @@ -207,7 +207,7 @@ tape( 'the function returns `+0.0` if provided a value greater than `~710.476`', for ( i = 0; i < 500; i++ ) { v = ( randu()*1e6 ) + 710.476; y = csch( v ); - t.equal( isPositiveZero( y ), true, 'returns +0.0' ); + t.equal( isPositiveZero( y ), true, 'returns expected value' ); } t.end(); }); @@ -220,7 +220,7 @@ tape( 'the function returns `-0.0` if provided a value less than `~-709.0896`', for ( i = 0; i < 500; i++ ) { v = ( -randu()*1e6 ) - 709.0896; y = csch( v ); - t.equal( isNegativeZero( y ), true, 'returns -0.0' ); + t.equal( isNegativeZero( y ), true, 'returns expected value' ); } t.end(); }); diff --git a/base/special/csch/test/test.native.js b/base/special/csch/test/test.native.js index 78529e724..3e8dc0f97 100644 --- a/base/special/csch/test/test.native.js +++ b/base/special/csch/test/test.native.js @@ -180,31 +180,31 @@ tape( 'the function computes the hyperbolic cosecant (tiny positive)', opts, fun tape( 'the function returns `NaN` if provided a `NaN`', opts, function test( t ) { var v = csch( NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `+Infinity` if provided `+0.0`', opts, function test( t ) { var v = csch( +0.0 ); - t.equal( v, PINF, 'returns +Infinity' ); + t.equal( v, PINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `-Infinity` if provided `-0.0`', opts, function test( t ) { var v = csch( -0.0 ); - t.equal( v, NINF, 'returns -Infinity' ); + t.equal( v, NINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `+0.0` if provided `+Infinity`', opts, function test( t ) { var v = csch( PINF ); - t.equal( isPositiveZero(v), true, 'returns +0.0' ); + t.equal( isPositiveZero(v), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `-0.0` if provided `-Infinity`', opts, function test( t ) { var v = csch( NINF ); - t.equal( isNegativeZero(v), true, 'returns -0.0' ); + t.equal( isNegativeZero(v), true, 'returns expected value' ); t.end(); }); @@ -216,7 +216,7 @@ tape( 'the function returns `+0.0` if provided a value greater than `~710.476`', for ( i = 0; i < 500; i++ ) { v = ( randu() * 1e6 ) + 710.476; y = csch( v ); - t.equal( isPositiveZero( y ), true, 'returns +0.0' ); + t.equal( isPositiveZero( y ), true, 'returns expected value' ); } t.end(); }); @@ -229,7 +229,7 @@ tape( 'the function returns `-0.0` if provided a value less than `~-709.0896`', for ( i = 0; i < 500; i++ ) { v = ( -randu() * 1e6 ) - 709.0896; y = csch( v ); - t.equal( isNegativeZero( y ), true, 'returns -0.0' ); + t.equal( isNegativeZero( y ), true, 'returns expected value' ); } t.end(); });