Skip to content

Commit fd79a0c

Browse files
committed
chore: changes from code review
1 parent 0a92b55 commit fd79a0c

File tree

6 files changed

+22
-19
lines changed

6 files changed

+22
-19
lines changed

lib/node_modules/@stdlib/math/base/special/acosdf/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Computes the [arccosine][arccosine] (in degrees) of a single-precision floating-
3636

3737
```javascript
3838
var sqrt = require( '@stdlib/math/base/special/sqrt' );
39+
3940
var v = acosdf( 0.0 );
4041
// returns 90.0
4142

@@ -116,11 +117,11 @@ for ( i = 0; i < x.length; i++ ) {
116117
Computes the [arccosine][arccosine] (in degrees) of a single-precision floating-point number.
117118

118119
```c
119-
float out = stdlib_base_acosdf( 0.0 );
120-
// returns 90.0
120+
float out = stdlib_base_acosdf( 0.0f );
121+
// returns 90.0f
121122

122-
out = stdlib_base_acosdf( 0.5 );
123-
// returns ~60.0
123+
out = stdlib_base_acosdf( 0.5f );
124+
// returns ~60.0f
124125
```
125126

126127
The function accepts the following arguments:

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

Lines changed: 4 additions & 3 deletions
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 isnanf = require( '@stdlib/math/base/assert/is-nanf' );
2626
var pkg = require( './../package.json' ).name;
2727
var acosdf = require( './../lib' );
@@ -34,10 +34,11 @@ bench( pkg, function benchmark( b ) {
3434
var y;
3535
var i;
3636

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

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

Lines changed: 4 additions & 3 deletions
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 isnanf = require( '@stdlib/math/base/assert/is-nanf' );
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, -1.0, 1.0 );
47+
4648
b.tic();
4749
for ( i = 0; i < b.iterations; i++ ) {
48-
x = ( randu() * 2.0 ) - 1.0;
49-
y = acosdf( x );
50+
y = acosdf( x[ i % x.length ] );
5051
if ( isnanf( y ) ) {
5152
b.fail( 'should not return NaN' );
5253
}

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <time.h>
2424
#include <sys/time.h>
2525

26-
#define NAME "acosd"
26+
#define NAME "acosdf"
2727
#define ITERATIONS 1000000
2828
#define REPEATS 3
2929

@@ -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 ] = ( 2.0f * rand_float() ) - 1.0f;
101+
}
102+
99103
t = tic();
100104
for ( i = 0; i < ITERATIONS; i++ ) {
101-
x = ( 2.0 * rand_float() ) - 1.0;
102-
y = stdlib_base_acosdf( x );
105+
y = stdlib_base_acosdf( x[ i % 100 ] );
103106
if ( y != y ) {
104107
printf( "should not return NaN\n" );
105108
break;

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ var acosf = require( '@stdlib/math/base/special/acosf' );
5353
* // returns NaN
5454
*/
5555
function acosdf( x ) {
56-
var rad = acosf( x );
57-
return rad2degf( rad );
56+
return rad2degf( acosf( x ) );
5857
}
5958

6059

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
* // returns 90.0f
3232
*/
3333
float stdlib_base_acosdf( const float x ) {
34-
float rad;
35-
36-
rad = stdlib_base_acosf( x );
34+
float rad = stdlib_base_acosf( x );
3735
return stdlib_base_rad2degf( rad );
3836
}

0 commit comments

Comments
 (0)