Skip to content

Commit f03a3e8

Browse files
committed
fix: apply code suggestions
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: missing_dependencies - task: lint_c_examples status: missing_dependencies - task: lint_c_benchmarks status: missing_dependencies - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 47acd0e commit f03a3e8

8 files changed

Lines changed: 30 additions & 16 deletions

File tree

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ bench( pkg, function benchmark( b ) {
3535
var y;
3636
var i;
3737

38-
x = uniform( 100, 0.0, 10.0 );
39-
y = uniform( 100, 0.0, 10.0 );
38+
x = uniform( 100, 0.0, 10.0, {
39+
'dtype': 'float32'
40+
});
41+
y = uniform( 100, 0.0, 10.0, {
42+
'dtype': 'float32'
43+
});
4044

4145
b.tic();
4246
for ( i = 0; i < b.iterations; i++ ) {

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,12 @@ bench( format( '%s::native', pkg ), opts, function benchmark( b ) {
4545
var y;
4646
var i;
4747

48-
x = uniform( 100, 0.0, 100.0 );
49-
y = uniform( 100, 0.0, 5.0 );
48+
x = uniform( 100, 0.0, 10.0, {
49+
'dtype': 'float32'
50+
});
51+
y = uniform( 100, 0.0, 10.0, {
52+
'dtype': 'float32'
53+
});
5054

5155
b.tic();
5256
for ( i = 0; i < b.iterations; i++ ) {

lib/node_modules/@stdlib/math/base/special/xlog1pyf/benchmark/c/Makefile renamed to lib/node_modules/@stdlib/math/base/special/xlog1pyf/benchmark/c/native/Makefile

File renamed without changes.

lib/node_modules/@stdlib/math/base/special/xlog1pyf/benchmark/c/benchmark.c renamed to lib/node_modules/@stdlib/math/base/special/xlog1pyf/benchmark/c/native/benchmark.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ static double tic( void ) {
7979
*
8080
* @return random number
8181
*/
82-
static float rand_double( void ) {
82+
static float rand_float( void ) {
8383
int r = rand();
8484
return (float)r / ( (float)RAND_MAX + 1.0f );
8585
}
@@ -93,13 +93,13 @@ static double benchmark( void ) {
9393
float x[ 100 ];
9494
float y[ 100 ];
9595
double elapsed;
96-
double out;
96+
float out;
9797
double t;
9898
int i;
9999

100100
for ( i = 0; i < 100; i++ ) {
101-
x[ i ] = ( 100.0f*rand_double() );
102-
y[ i ] = ( 5.0f*rand_double() );
101+
x[ i ] = ( 100.0f*rand_float() );
102+
y[ i ] = ( 5.0f*rand_float() );
103103
}
104104

105105
t = tic();

lib/node_modules/@stdlib/math/base/special/xlog1pyf/examples/c/example.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ int main( void ) {
2727
int i;
2828

2929
for ( i = 0; i < 100; i++ ) {
30-
x = ( (float)rand() / (float)RAND_MAX ) * 100.0;
31-
y = ( (float)rand() / (float)RAND_MAX ) * 5.0;
30+
x = ( (float)rand() / (float)RAND_MAX ) * 100.0f;
31+
y = ( (float)rand() / (float)RAND_MAX ) * 5.0f;
3232
out = stdlib_base_xlog1pyf( x, y );
3333
printf( "xlog1pyf(%f, %f) = %f\n", x, y, out );
3434
}

lib/node_modules/@stdlib/math/base/special/xlog1pyf/examples/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ for ( i = 0; i < 100; i++ ) {
3131
x = 0.0;
3232
}
3333
y = ( randu() * 20.0 ) - 5.0;
34-
console.log( 'xlog1pyf(%f, %f) = %f', x, y, xlog1pyf( x, y ) );
34+
console.log( 'xlog1pyf(%d, %d) = %d', x, y, xlog1pyf( x, y ) );
3535
}

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ var log1pf = require( '@stdlib/math/base/special/log1pf' );
2525
var f32 = require( '@stdlib/number/float64/base/to-float32' );
2626

2727

28+
// VARIABLES //
29+
30+
var ZER0 = f32( 0.0 );
31+
32+
2833
// MAIN //
2934

3035
/**
@@ -67,10 +72,10 @@ var f32 = require( '@stdlib/number/float64/base/to-float32' );
6772
* // returns NaN
6873
*/
6974
function xlog1pyf( x, y ) {
70-
if ( x === 0.0 && !isnanf( y ) ) {
71-
return 0.0;
75+
if ( x === ZER0 && !isnanf( y ) ) {
76+
return ZER0;
7277
}
73-
return f32(f32(x) * log1pf( y ));
78+
return f32( f32(x) * log1pf( y ) );
7479
}
7580

7681

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

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

19+
#include "stdlib/math/base/special/xlog1pyf.h"
1920
#include "stdlib/math/base/special/log1pf.h"
2021
#include "stdlib/math/base/assert/is_nanf.h"
2122

@@ -28,11 +29,11 @@
2829
*
2930
* @example
3031
* float out = stdlib_base_xlog1pyf( 3.0, 2.0 );
31-
* // returns ~3.296
32+
* // returns ~3.296f
3233
*
3334
* @example
3435
* float out = stdlib_base_xlog1pyf( 0.0, -2.0 );
35-
* // returns 0.0
36+
* // returns 0.0f
3637
*/
3738
float stdlib_base_xlog1pyf( const float x, const float y ) {
3839
if ( x == 0.0f && !stdlib_base_is_nanf( y ) ) {

0 commit comments

Comments
 (0)