Skip to content
Open
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
6 changes: 3 additions & 3 deletions lib/node_modules/@stdlib/math/base/special/pow/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
var isInteger = require( '@stdlib/math/base/assert/is-integer' );
var sqrt = require( '@stdlib/math/base/special/sqrt' );
var abs = require( '@stdlib/math/base/special/abs' );
var toWords = require( '@stdlib/number/float64/base/to-words' );

Check warning on line 43 in lib/node_modules/@stdlib/math/base/special/pow/lib/main.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

only the `assign` property of the required module is used; require the property directly
var setLowWord = require( '@stdlib/number/float64/base/set-low-word' );
var uint32ToInt32 = require( '@stdlib/number/uint32/base/to-int32' );
var NINF = require( '@stdlib/constants/float64/ninf' );
Expand Down Expand Up @@ -82,7 +82,7 @@
var HUGE = 1.0e300;
var TINY = 1.0e-300;

// -(1024-log2(ovfl+.5ulp))

Check warning on line 85 in lib/node_modules/@stdlib/math/base/special/pow/lib/main.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unknown word: "ovfl"
var OVT = 8.0085662595372944372e-17;

// High/low words workspace:
Expand Down Expand Up @@ -229,10 +229,10 @@
if ( y === -1.0 ) {
return 1.0 / x;
}
if ( y === 0.5 ) {
if ( y === 0.5 && x > 0.0 ) {
return sqrt( x );
}
if ( y === -0.5 ) {
if ( y === -0.5 && x > 0.0 ) {
return 1.0 / sqrt( x );
}
if ( y === 2.0 ) {
Expand All @@ -256,7 +256,7 @@

// Special cases `x`...
if ( lx === 0 ) {
if ( hx === 0 ) {
if ( ( hx & ABS_MASK ) === 0 ) {
return xIsZero( x, y );
}
if ( x === 1.0 ) {
Expand Down
6 changes: 3 additions & 3 deletions lib/node_modules/@stdlib/math/base/special/pow/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,10 @@ double stdlib_base_pow( const double x, const double y ) {
if ( y == -1.0 ) {
return 1.0 / xc;
}
if ( y == 0.5 ) {
if ( y == 0.5 && xc > 0.0 ) {
return stdlib_base_sqrt( xc );
}
if ( y == -0.5 ) {
if ( y == -0.5 && xc > 0.0 ) {
return 1.0 / stdlib_base_sqrt( xc );
}
if ( y == 2.0 ) {
Expand All @@ -612,7 +612,7 @@ double stdlib_base_pow( const double x, const double y ) {

// Special cases `x`...
if ( lx == 0 ) {
if ( hx == 0 ) {
if ( ( hx & STDLIB_CONSTANT_FLOAT64_HIGH_WORD_ABS_MASK ) == 0 ) {
return x_is_zero( xc, y );
}
if ( xc == 1.0 ) {
Expand Down
14 changes: 14 additions & 0 deletions lib/node_modules/@stdlib/math/base/special/pow/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,20 @@ tape( '`-1` raised to any odd integer is `-1`', function test( t ) {
t.end();
});

tape( '`-0` and `-infinity` raised to a non-integer power return `+0` or `+infinity`', function test( t ) {
var y;
var i;

y = [ 0.5, 0.25, 2.5 ];
for ( i = 0; i < y.length; i++ ) {
t.strictEqual( isPositiveZero( pow( -0.0, y[ i ] ) ), true, 'returns expected value' );
t.strictEqual( pow( -0.0, -y[ i ] ), PINF, 'returns expected value' );
t.strictEqual( pow( NINF, y[ i ] ), PINF, 'returns expected value' );
t.strictEqual( isPositiveZero( pow( NINF, -y[ i ] ) ), true, 'returns expected value' );
}
t.end();
});

tape( '`+-0` raised to `-infinity` is `+infinity`', function test( t ) {
var v;

Expand Down
14 changes: 14 additions & 0 deletions lib/node_modules/@stdlib/math/base/special/pow/test/test.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,20 @@ tape( '`-1` raised to any odd integer is `-1`', opts, function test( t ) {
t.end();
});

tape( '`-0` and `-infinity` raised to a non-integer power return `+0` or `+infinity`', opts, function test( t ) {
var y;
var i;

y = [ 0.5, 0.25, 2.5 ];
for ( i = 0; i < y.length; i++ ) {
t.strictEqual( isPositiveZero( pow( -0.0, y[ i ] ) ), true, 'returns expected value' );
t.strictEqual( pow( -0.0, -y[ i ] ), PINF, 'returns expected value' );
t.strictEqual( pow( NINF, y[ i ] ), PINF, 'returns expected value' );
t.strictEqual( isPositiveZero( pow( NINF, -y[ i ] ) ), true, 'returns expected value' );
}
t.end();
});

tape( '`+-0` raised to `-infinity` is `+infinity`', opts, function test( t ) {
var v;

Expand Down
4 changes: 2 additions & 2 deletions lib/node_modules/@stdlib/math/base/special/powf/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
var HUGE = f32( 1.0e30 );
var TINY = f32( 1.0e-30 );

// -(128-log2(ovfl+.5ulp))

Check warning on line 69 in lib/node_modules/@stdlib/math/base/special/powf/lib/main.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unknown word: "ovfl"
var OVT = f32( 4.2995665694e-08 );

// 2^27 = 134217728.0 => 1 0011010 00000000000000000000000 => 0x4d000000 = 1291845632
Expand Down Expand Up @@ -170,10 +170,10 @@
if ( y === NEG_ONE ) {
return f32( ONE / x );
}
if ( y === HALF ) {
if ( y === HALF && x > ZERO ) {
return sqrtf( x );
}
if ( y === NEG_HALF ) {
if ( y === NEG_HALF && x > ZERO ) {
return f32( ONE / sqrtf( x ) );
}
if ( y === TWO ) {
Expand Down
4 changes: 2 additions & 2 deletions lib/node_modules/@stdlib/math/base/special/powf/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,10 +532,10 @@ float stdlib_base_powf( const float x, const float y ) {
if ( y == -1.0f ) {
return 1.0f / x;
}
if ( y == 0.5f ) {
if ( y == 0.5f && x > 0.0f ) {
return stdlib_base_sqrtf( x );
}
if ( y == -0.5f ) {
if ( y == -0.5f && x > 0.0f ) {
return 1.0f / stdlib_base_sqrtf( x );
}
if ( y == 2.0f ) {
Expand Down
14 changes: 14 additions & 0 deletions lib/node_modules/@stdlib/math/base/special/powf/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,20 @@ tape( '`-1` raised to any odd integer is `-1`', function test( t ) {
t.end();
});

tape( '`-0` and `-infinity` raised to a non-integer power return `+0` or `+infinity`', function test( t ) {
var y;
var i;

y = [ 0.5, 0.25, 2.5 ];
for ( i = 0; i < y.length; i++ ) {
t.strictEqual( isPositiveZerof( powf( -0.0, y[ i ] ) ), true, 'returns expected value' );
t.strictEqual( powf( -0.0, -y[ i ] ), PINF, 'returns expected value' );
t.strictEqual( powf( NINF, y[ i ] ), PINF, 'returns expected value' );
t.strictEqual( isPositiveZerof( powf( NINF, -y[ i ] ) ), true, 'returns expected value' );
}
t.end();
});

tape( '`+-0` raised to `-infinity` is `+infinity`', function test( t ) {
var v;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,20 @@ tape( '`-1` raised to any odd integer is `-1`', opts, function test( t ) {
t.end();
});

tape( '`-0` and `-infinity` raised to a non-integer power return `+0` or `+infinity`', opts, function test( t ) {
var y;
var i;

y = [ 0.5, 0.25, 2.5 ];
for ( i = 0; i < y.length; i++ ) {
t.strictEqual( isPositiveZerof( powf( -0.0, y[ i ] ) ), true, 'returns expected value' );
t.strictEqual( powf( -0.0, -y[ i ] ), PINF, 'returns expected value' );
t.strictEqual( powf( NINF, y[ i ] ), PINF, 'returns expected value' );
t.strictEqual( isPositiveZerof( powf( NINF, -y[ i ] ) ), true, 'returns expected value' );
}
t.end();
});

tape( '`+-0` raised to `-infinity` is `+infinity`', opts, function test( t ) {
var v;

Expand Down
Loading