Skip to content

Commit 41a7874

Browse files
authored
Apply suggestions from code review
Signed-off-by: Gunj Joshi <[email protected]>
1 parent b600358 commit 41a7874

File tree

12 files changed

+28
-28
lines changed

12 files changed

+28
-28
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020

2121
# logitf
2222

23-
> Compute the [logit][logit] function for single precision-floating point number.
23+
> Compute the [logit][logit] function for a single-precision floating-point number.
2424
2525
<section class="intro">
2626

@@ -55,7 +55,7 @@ var logitf = require( '@stdlib/math/base/special/logitf' );
5555

5656
#### logitf( p )
5757

58-
Computes the [logit][logit] function for single precision-floating point number.
58+
Computes the [logit][logit] function for a single-precision floating-point number.
5959

6060
```javascript
6161
var v = logitf( 0.2 );
@@ -93,11 +93,11 @@ var len = 100;
9393
var opts = {
9494
'dtype': 'float32'
9595
};
96-
var p = uniform( len, 0, 1, opts );
96+
var p = uniform( len, 0.0, 1.0, opts );
9797
var i;
9898

9999
for ( i = 0; i < 100; i++ ) {
100-
console.log( 'logitf(%f) = %f', p[ i ], logitf( p[ i ] ) );
100+
console.log( 'logitf(%d) = %d', p[ i ], logitf( p[ i ] ) );
101101
}
102102
```
103103

@@ -133,14 +133,14 @@ for ( i = 0; i < 100; i++ ) {
133133

134134
#### stdlib_base_logitf( p )
135135

136-
Computes the [logit][logit] function for single precision-floating point number.
136+
Computes the [logit][logit] function for a single-precision floating-point number.
137137

138138
```c
139-
float out = stdlib_base_logitf( 0.2 );
140-
// returns ~-1.386
139+
float out = stdlib_base_logitf( 0.2f );
140+
// returns ~-1.386f
141141

142-
out = stdlib_base_logitf( 0.9 );
143-
// returns ~2.197
142+
out = stdlib_base_logitf( 0.9f );
143+
// returns ~2.197f
144144
```
145145

146146
The function accepts the following arguments:
@@ -180,7 +180,7 @@ int main( void ) {
180180
int i;
181181
182182
for ( i = 0; i < 100; i++ ) {
183-
x = ( float )rand() / ( float )RAND_MAX;
183+
x = (float)rand() / (float)RAND_MAX;
184184
v = stdlib_base_logitf( x );
185185
printf( "logitf(%f) = %f\n", x, v );
186186
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ bench( pkg, function benchmark( b ) {
4141
};
4242

4343
len = 100;
44-
x = uniform( len, 0, 1, opts );
44+
x = uniform( len, 0.0, 1.0, opts );
4545

4646
b.tic();
4747
for ( i = 0; i < b.iterations; i++ ) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ bench( pkg+'::native', opts, function benchmark( b ) {
5050
};
5151

5252
len = 100;
53-
x = uniform( len, 0, 1, opts );
53+
x = uniform( len, 0.0, 1.0, opts );
5454

5555
b.tic();
5656
for ( i = 0; i < b.iterations; i++ ) {

lib/node_modules/@stdlib/math/base/special/logitf/benchmark/c/benchmark.c

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

25-
#define NAME "logit"
25+
#define NAME "logitf"
2626
#define ITERATIONS 1000000
2727
#define REPEATS 3
2828

@@ -78,13 +78,13 @@ static double tic( void ) {
7878
*
7979
* @return random number
8080
*/
81-
static double rand_double( void ) {
81+
static float rand_float( void ) {
8282
int r = rand();
83-
return (double)r / ( (double)RAND_MAX + 1.0 );
83+
return (float)r / ( (float)RAND_MAX + 1.0f );
8484
}
8585

8686
/**
87-
* Evaluates the logit function.
87+
* Computes the logit function for a single-precision floating-point number.
8888
*
8989
* @param x input value
9090
* @return result

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ static float rand_float( void ) {
9292
static double benchmark( void ) {
9393
double elapsed;
9494
float x[ 100 ];
95-
float y;
9695
double t;
96+
float y;
9797
int i;
9898

9999
for ( i = 0; i < 100; i++ ) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
{{alias}}( p )
3-
Evaluates the logit function for single precision-floating point number.
3+
Evaluates the logit function for a single-precision floating-point number.
44

55
Let `p` be the probability of some event. The logit function is defined as
66
the logarithm of the odds `p / (1-p)`.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ var len = 100;
2525
var opts = {
2626
'dtype': 'float32'
2727
};
28-
var p = uniform( len, 0, 1, opts );
28+
var p = uniform( len, 0.0, 1.0, opts );
2929
var i;
3030

3131
for ( i = 0; i < 100; i++ ) {
32-
console.log( 'logitf(%f) = %f', p[ i ], logitf( p[ i ] ) );
32+
console.log( 'logitf(%d) = %d', p[ i ], logitf( p[ i ] ) );
3333
}

lib/node_modules/@stdlib/math/base/special/logitf/include/stdlib/math/base/special/logitf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extern "C" {
2727
#endif
2828

2929
/**
30-
* Evaluates the logit function for single precision-floating point number.
30+
* Evaluates the logit function for a single-precision floating-point number.
3131
*/
3232
float stdlib_base_logitf( const float p );
3333

lib/node_modules/@stdlib/math/base/special/logitf/lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
'use strict';
2020

2121
/**
22-
* Evaluate the logit function for single precision-floating point number.
22+
* Evaluate the logit function for single-precision floating-point number.
2323
*
2424
* @module @stdlib/math/base/special/logitf
2525
*

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var NINF = require( '@stdlib/constants/float32/ninf' );
3030
// MAIN //
3131

3232
/**
33-
* Evaluates the logit function for single precision-floating point number.
33+
* Evaluates the logit function for a single-precision floating-point number.
3434
*
3535
* @param {Probability} p - input value
3636
* @returns {number} function value

0 commit comments

Comments
 (0)