Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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( '@stdlib/math/base/assert/is-nan' );
var pkg = require( './../package.json' ).name;
var csch = require( './../lib' );
Expand All @@ -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' );
}
Expand Down
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' );
var randu = require( '@stdlib/random/base/randu' );
var randu = require( '@stdlib/random/array/uniform' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var tryRequire = require( '@stdlib/utils/try-require' );
var pkg = require( './../package.json' ).name;
Expand All @@ -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' );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
64 changes: 1 addition & 63 deletions lib/node_modules/@stdlib/math/base/special/csch/src/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#/
# @license Apache-2.0
#
# Copyright (c) 2024 The Stdlib Authors.
Expand Down Expand Up @@ -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 #

#/
Expand Down
14 changes: 7 additions & 7 deletions lib/node_modules/@stdlib/math/base/special/csch/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand All @@ -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();
});
Expand All @@ -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();
});
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand All @@ -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();
});
Expand All @@ -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();
});