Skip to content

Commit c660c70

Browse files
authored
chore: use correct Makefile and update benchmarks in math/base/special/csch
PR-URL: #3209 Reviewed-by: Athan Reines <kgryte@gmail.com>
1 parent 062fad0 commit c660c70

File tree

6 files changed

+29
-86
lines changed

6 files changed

+29
-86
lines changed

lib/node_modules/@stdlib/math/base/special/csch/benchmark/benchmark.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench' );
24-
var randu = require( '@stdlib/random/base/randu' );
24+
var randu = require( '@stdlib/random/array/uniform' );
2525
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2626
var pkg = require( './../package.json' ).name;
2727
var csch = require( './../lib' );
@@ -34,10 +34,11 @@ bench( pkg, function benchmark( b ) {
3434
var y;
3535
var i;
3636

37+
x = randu( 100, -5.0, 5.0 );
38+
3739
b.tic();
3840
for ( i = 0; i < b.iterations; i++ ) {
39-
x = ( randu()*10.0 ) - 5.0;
40-
y = csch( x );
41+
y = csch( x[ i % x.length ] );
4142
if ( isnan( y ) ) {
4243
b.fail( 'should not return NaN' );
4344
}

lib/node_modules/@stdlib/math/base/special/csch/benchmark/benchmark.native.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench' );
25-
var randu = require( '@stdlib/random/base/randu' );
25+
var randu = require( '@stdlib/random/array/uniform' );
2626
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2727
var tryRequire = require( '@stdlib/utils/try-require' );
2828
var pkg = require( './../package.json' ).name;
@@ -43,10 +43,11 @@ bench( pkg+'::native', opts, function benchmark( b ) {
4343
var y;
4444
var i;
4545

46+
x = randu( 100, -5.0, 5.0 );
47+
4648
b.tic();
4749
for ( i = 0; i < b.iterations; i++ ) {
48-
x = ( randu() * 10.0 ) - 5.0;
49-
y = csch( x );
50+
y = csch( x[ i % x.length ] );
5051
if ( isnan( y ) ) {
5152
b.fail( 'should not return NaN' );
5253
}

lib/node_modules/@stdlib/math/base/special/csch/benchmark/c/native/benchmark.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,18 @@ static double rand_double( void ) {
9191
*/
9292
static double benchmark( void ) {
9393
double elapsed;
94-
double x;
94+
double x[ 100 ];
9595
double y;
9696
double t;
9797
int i;
9898

99+
for ( i = 0; i < 100; i++ ) {
100+
x[ i ] = ( 10.0 * rand_double() ) - 5.0;
101+
}
102+
99103
t = tic();
100104
for ( i = 0; i < ITERATIONS; i++ ) {
101-
x = ( 10.0 * rand_double() ) - 5.0;
102-
y = stdlib_base_csch( x );
105+
y = stdlib_base_csch( x[ i % 100 ] );
103106
if ( y != y ) {
104107
printf( "should not return NaN\n" );
105108
break;

lib/node_modules/@stdlib/math/base/special/csch/src/Makefile

+1-63
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#/
12
# @license Apache-2.0
23
#
34
# Copyright (c) 2024 The Stdlib Authors.
@@ -45,69 +46,6 @@ endif
4546
endif
4647

4748

48-
# RULES #
49-
50-
#/
51-
# Removes generated files for building an add-on.
52-
#
53-
# @example
54-
# make clean-addon
55-
#/
56-
clean-addon:
57-
$(QUIET) -rm -f *.o *.node
58-
59-
.PHONY: clean-addon
60-
61-
#/
62-
# Removes generated files.
63-
#
64-
# @example
65-
# make clean
66-
#/
67-
clean: clean-addon
68-
69-
.PHONY: clean
70-
copy of the License at
71-
#
72-
# http://www.apache.org/licenses/LICENSE-2.0
73-
#
74-
# Unless required by applicable law or agreed to in writing, software
75-
# distributed under the License is distributed on an "AS IS" BASIS,
76-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
77-
# See the License for the specific language governing permissions and
78-
# limitations under the License.
79-
#/
80-
81-
# VARIABLES #
82-
83-
ifndef VERBOSE
84-
QUIET := @
85-
else
86-
QUIET :=
87-
endif
88-
89-
# Determine the OS ([1][1], [2][2]).
90-
#
91-
# [1]: https://en.wikipedia.org/wiki/Uname#Examples
92-
# [2]: http://stackoverflow.com/a/27776822/2225624
93-
OS ?= $(shell uname)
94-
ifneq (, $(findstring MINGW,$(OS)))
95-
OS := WINNT
96-
else
97-
ifneq (, $(findstring MSYS,$(OS)))
98-
OS := WINNT
99-
else
100-
ifneq (, $(findstring CYGWIN,$(OS)))
101-
OS := WINNT
102-
else
103-
ifneq (, $(findstring Windows_NT,$(OS)))
104-
OS := WINNT
105-
endif
106-
endif
107-
endif
108-
endif
109-
110-
11149
# RULES #
11250

11351
#/

lib/node_modules/@stdlib/math/base/special/csch/test/test.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -171,31 +171,31 @@ tape( 'the function computes the hyperbolic cosecant (tiny positive)', function
171171

172172
tape( 'the function returns `NaN` if provided a `NaN`', function test( t ) {
173173
var v = csch( NaN );
174-
t.equal( isnan( v ), true, 'returns NaN' );
174+
t.equal( isnan( v ), true, 'returns expected value' );
175175
t.end();
176176
});
177177

178178
tape( 'the function returns `+Infinity` if provided `+0.0`', function test( t ) {
179179
var v = csch( +0.0 );
180-
t.equal( v, PINF, 'returns +Infinity' );
180+
t.equal( v, PINF, 'returns expected value' );
181181
t.end();
182182
});
183183

184184
tape( 'the function returns `-Infinity` if provided `-0.0`', function test( t ) {
185185
var v = csch( -0.0 );
186-
t.equal( v, NINF, 'returns -Infinity' );
186+
t.equal( v, NINF, 'returns expected value' );
187187
t.end();
188188
});
189189

190190
tape( 'the function returns `+0.0` if provided `+Infinity`', function test( t ) {
191191
var v = csch( PINF );
192-
t.equal( isPositiveZero(v), true, 'returns +0.0' );
192+
t.equal( isPositiveZero(v), true, 'returns expected value' );
193193
t.end();
194194
});
195195

196196
tape( 'the function returns `-0.0` if provided `-Infinity`', function test( t ) {
197197
var v = csch( NINF );
198-
t.equal( isNegativeZero(v), true, 'returns -0.0' );
198+
t.equal( isNegativeZero(v), true, 'returns expected value' );
199199
t.end();
200200
});
201201

@@ -207,7 +207,7 @@ tape( 'the function returns `+0.0` if provided a value greater than `~710.476`',
207207
for ( i = 0; i < 500; i++ ) {
208208
v = ( randu()*1e6 ) + 710.476;
209209
y = csch( v );
210-
t.equal( isPositiveZero( y ), true, 'returns +0.0' );
210+
t.equal( isPositiveZero( y ), true, 'returns expected value' );
211211
}
212212
t.end();
213213
});
@@ -220,7 +220,7 @@ tape( 'the function returns `-0.0` if provided a value less than `~-709.0896`',
220220
for ( i = 0; i < 500; i++ ) {
221221
v = ( -randu()*1e6 ) - 709.0896;
222222
y = csch( v );
223-
t.equal( isNegativeZero( y ), true, 'returns -0.0' );
223+
t.equal( isNegativeZero( y ), true, 'returns expected value' );
224224
}
225225
t.end();
226226
});

lib/node_modules/@stdlib/math/base/special/csch/test/test.native.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -180,31 +180,31 @@ tape( 'the function computes the hyperbolic cosecant (tiny positive)', opts, fun
180180

181181
tape( 'the function returns `NaN` if provided a `NaN`', opts, function test( t ) {
182182
var v = csch( NaN );
183-
t.equal( isnan( v ), true, 'returns NaN' );
183+
t.equal( isnan( v ), true, 'returns expected value' );
184184
t.end();
185185
});
186186

187187
tape( 'the function returns `+Infinity` if provided `+0.0`', opts, function test( t ) {
188188
var v = csch( +0.0 );
189-
t.equal( v, PINF, 'returns +Infinity' );
189+
t.equal( v, PINF, 'returns expected value' );
190190
t.end();
191191
});
192192

193193
tape( 'the function returns `-Infinity` if provided `-0.0`', opts, function test( t ) {
194194
var v = csch( -0.0 );
195-
t.equal( v, NINF, 'returns -Infinity' );
195+
t.equal( v, NINF, 'returns expected value' );
196196
t.end();
197197
});
198198

199199
tape( 'the function returns `+0.0` if provided `+Infinity`', opts, function test( t ) {
200200
var v = csch( PINF );
201-
t.equal( isPositiveZero(v), true, 'returns +0.0' );
201+
t.equal( isPositiveZero(v), true, 'returns expected value' );
202202
t.end();
203203
});
204204

205205
tape( 'the function returns `-0.0` if provided `-Infinity`', opts, function test( t ) {
206206
var v = csch( NINF );
207-
t.equal( isNegativeZero(v), true, 'returns -0.0' );
207+
t.equal( isNegativeZero(v), true, 'returns expected value' );
208208
t.end();
209209
});
210210

@@ -216,7 +216,7 @@ tape( 'the function returns `+0.0` if provided a value greater than `~710.476`',
216216
for ( i = 0; i < 500; i++ ) {
217217
v = ( randu() * 1e6 ) + 710.476;
218218
y = csch( v );
219-
t.equal( isPositiveZero( y ), true, 'returns +0.0' );
219+
t.equal( isPositiveZero( y ), true, 'returns expected value' );
220220
}
221221
t.end();
222222
});
@@ -229,7 +229,7 @@ tape( 'the function returns `-0.0` if provided a value less than `~-709.0896`',
229229
for ( i = 0; i < 500; i++ ) {
230230
v = ( -randu() * 1e6 ) - 709.0896;
231231
y = csch( v );
232-
t.equal( isNegativeZero( y ), true, 'returns -0.0' );
232+
t.equal( isNegativeZero( y ), true, 'returns expected value' );
233233
}
234234
t.end();
235235
});

0 commit comments

Comments
 (0)