Skip to content

Commit cb42022

Browse files
add math/base/special/gammasgnf
--- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: passed - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: passed - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: passed ---
1 parent 16dc7a8 commit cb42022

File tree

14 files changed

+61
-55
lines changed

14 files changed

+61
-55
lines changed

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,36 +21,37 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench' );
24-
var Float64Array = require( '@stdlib/array/float64' );
25-
var randu = require( '@stdlib/random/base/randu' );
26-
var isnan = require( '@stdlib/math/base/assert/is-nan' );
24+
var uniform = require( '@stdlib/random/array/uniform' );
25+
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
2726
var pkg = require( './../package.json' ).name;
2827
var gammasgnf = require( './../lib' );
2928

3029

3130
// MAIN //
3231

3332
bench( pkg, function benchmark( b ) {
33+
var opts;
3434
var len;
3535
var x;
3636
var y;
3737
var i;
3838

39+
opts = {
40+
'dtype': 'float32'
41+
};
42+
3943
len = 100;
40-
x = new Float64Array( len );
41-
for ( i = 0; i < len; i++ ) {
42-
x[ i ] = ( randu()*171.0 ) - 0.0;
43-
}
44+
x = uniform( len, 0, 171, opts );
4445

4546
b.tic();
4647
for ( i = 0; i < b.iterations; i++ ) {
47-
y = gammasgnf( x[ i%len ] );
48-
if ( isnan( y ) ) {
48+
y = gammasgnf( x[ i % len ] );
49+
if ( isnanf( y ) ) {
4950
b.fail( 'should not return NaN' );
5051
}
5152
}
5253
b.toc();
53-
if ( isnan( y ) ) {
54+
if ( isnanf( y ) ) {
5455
b.fail( 'should not return NaN' );
5556
}
5657
b.pass( 'benchmark finished' );

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@
2222

2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench' );
25-
var Float64Array = require( '@stdlib/array/float64' );
26-
var randu = require( '@stdlib/random/base/randu' );
27-
var isnan = require( '@stdlib/math/base/assert/is-nan' );
25+
var uniform = require( '@stdlib/random/array/uniform' );
26+
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
2827
var tryRequire = require( '@stdlib/utils/try-require' );
2928
var pkg = require( './../package.json' ).name;
3029

@@ -40,26 +39,28 @@ var opts = {
4039
// MAIN //
4140

4241
bench( pkg+'::native', opts, function benchmark( b ) {
42+
var opts;
4343
var len;
4444
var x;
4545
var y;
4646
var i;
4747

48+
opts = {
49+
'dtype': 'float32'
50+
};
51+
4852
len = 100;
49-
x = new Float64Array( len );
50-
for ( i = 0; i < len; i++ ) {
51-
x[ i ] = ( randu() * 171.0 ) - 0.0;
52-
}
53+
x = uniform( len, 0, 171, opts );
5354

5455
b.tic();
5556
for ( i = 0; i < b.iterations; i++ ) {
56-
y = gammasgnf( x[ i%len ] );
57-
if ( isnan( y ) ) {
57+
y = gammasgnf( x[ i % len ] );
58+
if ( isnanf( y ) ) {
5859
b.fail( 'should not return NaN' );
5960
}
6061
}
6162
b.toc();
62-
if ( isnan( y ) ) {
63+
if ( isnanf( y ) ) {
6364
b.fail( 'should not return NaN' );
6465
}
6566
b.pass( 'benchmark finished' );

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

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

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

lib/node_modules/@stdlib/math/base/special/gammasgnf/docs/repl.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
{{alias}}( x )
33

4-
Computes the sign of the gamma function for
4+
Computes the sign of the gamma function for
55
a single precision-floating number.
66

77
Parameters
@@ -14,6 +14,7 @@
1414
y: number
1515
Sign of the gamma function.
1616

17+
1718
Examples
1819
--------
1920
> var y = {{alias}}( 1.0 )

lib/node_modules/@stdlib/math/base/special/gammasgnf/lib/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
// MODULES //
2222

23-
var isnan = require( '@stdlib/math/base/assert/is-nan' );
23+
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
2424
var floorf = require( '@stdlib/math/base/special/floorf' );
2525

2626

@@ -48,7 +48,7 @@ var floorf = require( '@stdlib/math/base/special/floorf' );
4848
function gammasgnf( x ) {
4949
var fx;
5050

51-
if ( isnan( x ) ) {
51+
if ( isnanf( x ) ) {
5252
return x;
5353
}
5454
if ( x > 0 ) {

lib/node_modules/@stdlib/math/base/special/gammasgnf/manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"libpath": [],
3838
"dependencies": [
3939
"@stdlib/math/base/napi/unary",
40-
"@stdlib/math/base/assert/is-nan",
40+
"@stdlib/math/base/assert/is-nanf",
4141
"@stdlib/math/base/special/floorf"
4242
]
4343
},
@@ -52,7 +52,7 @@
5252
"libraries": [],
5353
"libpath": [],
5454
"dependencies": [
55-
"@stdlib/math/base/assert/is-nan",
55+
"@stdlib/math/base/assert/is-nanf",
5656
"@stdlib/math/base/special/floorf"
5757
]
5858
},
@@ -67,7 +67,7 @@
6767
"libraries": [],
6868
"libpath": [],
6969
"dependencies": [
70-
"@stdlib/math/base/assert/is-nan",
70+
"@stdlib/math/base/assert/is-nanf",
7171
"@stdlib/math/base/special/floorf"
7272
]
7373
}

lib/node_modules/@stdlib/math/base/special/gammasgnf/src/main.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
* limitations under the License.
1717
*/
1818

19-
#include "stdlib/math/base/assert/is_nan.h"
20-
#include "stdlib/math/base/special/floorf.h"
2119
#include "stdlib/math/base/special/gammasgnf.h"
20+
#include "stdlib/math/base/assert/is_nanf.h"
21+
#include "stdlib/math/base/special/floorf.h"
2222

2323
/**
2424
* Computes the sign of the gamma function for a single precision-floating point number.
@@ -27,25 +27,25 @@
2727
* @return sign of the gamma function
2828
*
2929
* @example
30-
* var v = gammasgnf( 1.0 );
30+
* var v = gammasgnf( 1.0f );
3131
* // returns 1.0
3232
*/
3333
float stdlib_base_gammasgnf( const float x ) {
3434
float fx;
3535

36-
if ( stdlib_base_is_nan( x ) ) {
36+
if ( stdlib_base_is_nanf( x ) ) {
3737
return x;
3838
}
3939
if ( x > 0 ) {
40-
return 1.0;
40+
return 1.0f;
4141
}
4242
fx = stdlib_base_floorf( x );
4343
if ( x == fx ) {
44-
return 0.0;
44+
return 0.0f;
4545
}
46-
fx /= 2.0;
46+
fx /= 2.0f;
4747
if ( fx == stdlib_base_floorf( fx ) ) {
48-
return 1.0;
48+
return 1.0f;
4949
}
50-
return -1.0;
50+
return -1.0f;
5151
}

lib/node_modules/@stdlib/math/base/special/gammasgnf/test/fixtures/python/medium_negative.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

lib/node_modules/@stdlib/math/base/special/gammasgnf/test/fixtures/python/medium_positive.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

lib/node_modules/@stdlib/math/base/special/gammasgnf/test/fixtures/python/random.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)