Skip to content

Commit b600358

Browse files
add math/base/special/logitf
1 parent 5a0da6c commit b600358

File tree

4 files changed

+50
-50
lines changed

4 files changed

+50
-50
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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/lib/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function logitf( p ) {
6868
if ( p === 1.0 ) {
6969
return PINF;
7070
}
71-
return lnf( p / ( 1.0-p ) );
71+
return lnf( p / ( 1.0 - p ) );
7272
}
7373

7474

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

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ tape( 'the function evaluates the logitf of `x` for the interval `(0,0.25]`', fu
8282
expected = small.expected;
8383
x = small.x;
8484
for ( i = 0; i < x.length; i++ ) {
85-
y = logitf( x[i] );
86-
if ( y === expected[i] ) {
87-
t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
85+
y = logitf( x[ i ] );
86+
if ( y === expected[ i ] ) {
87+
t.equal( y, expected[ i ], 'x: '+x[ i ]+', y: '+y+', expected: '+expected[ i ] );
8888
} else {
89-
delta = absf( y - expected[i] );
90-
tol = EPS * absf( expected[i] );
91-
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. v: '+y+'. E: '+expected[i]+' Δ: '+delta+'. tol: '+tol );
89+
delta = absf( y - expected[ i ] );
90+
tol = EPS * absf( expected[ i ] );
91+
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. v: '+y+'. E: '+expected[ i ]+' Δ: '+delta+'. tol: '+tol );
9292
}
9393
}
9494
t.end();
@@ -105,13 +105,13 @@ tape( 'the function evaluates the logitf of `x` for the interval `[0.25,0.49]`',
105105
expected = mediumBelow.expected;
106106
x = mediumBelow.x;
107107
for ( i = 0; i < x.length; i++ ) {
108-
y = logitf( x[i] );
109-
if ( y === expected[i] ) {
110-
t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
108+
y = logitf( x[ i ] );
109+
if ( y === expected[ i ] ) {
110+
t.equal( y, expected[ i ], 'x: '+x[ i ]+', y: '+y+', expected: '+expected[ i ] );
111111
} else {
112-
delta = absf( y - expected[i] );
113-
tol = EPS * 15 * absf( expected[i] );
114-
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. v: '+y+'. E: '+expected[i]+' Δ: '+delta+'. tol: '+tol );
112+
delta = absf( y - expected[ i ] );
113+
tol = EPS * 15 * absf( expected[ i ] );
114+
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. v: '+y+'. E: '+expected[ i ]+' Δ: '+delta+'. tol: '+tol );
115115
}
116116
}
117117
t.end();
@@ -128,13 +128,13 @@ tape( 'the function evaluates the logitf of `x` for the interval `[0.5,0.75]`',
128128
expected = mediumAbove.expected;
129129
x = mediumAbove.x;
130130
for ( i = 0; i < x.length; i++ ) {
131-
y = logitf( x[i] );
132-
if ( y === expected[i] ) {
133-
t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
131+
y = logitf( x[ i ] );
132+
if ( y === expected[ i ] ) {
133+
t.equal( y, expected[ i ], 'x: '+x[ i ]+', y: '+y+', expected: '+expected[ i ] );
134134
} else {
135-
delta = absf( y - expected[i] );
136-
tol = EPS * 15 * absf( expected[i] );
137-
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. v: '+y+'. E: '+expected[i]+' Δ: '+delta+'. tol: '+tol );
135+
delta = absf( y - expected[ i ] );
136+
tol = EPS * 15 * absf( expected[ i ] );
137+
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. v: '+y+'. E: '+expected[ i ]+' Δ: '+delta+'. tol: '+tol );
138138
}
139139
}
140140
t.end();
@@ -151,13 +151,13 @@ tape( 'the function evaluates the logitf of `x` for the interval `[0.75,1)`', fu
151151
expected = large.expected;
152152
x = large.x;
153153
for ( i = 0; i < x.length; i++ ) {
154-
y = logitf( x[i] );
155-
if ( y === expected[i] ) {
156-
t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
154+
y = logitf( x[ i ] );
155+
if ( y === expected[ i ] ) {
156+
t.equal( y, expected[ i ], 'x: '+x[ i ]+', y: '+y+', expected: '+expected[ i ] );
157157
} else {
158-
delta = absf( y - expected[i] );
159-
tol = EPS * absf( expected[i] );
160-
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. v: '+y+'. E: '+expected[i]+' Δ: '+delta+'. tol: '+tol );
158+
delta = absf( y - expected[ i ] );
159+
tol = EPS * absf( expected[ i ] );
160+
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. v: '+y+'. E: '+expected[ i ]+' Δ: '+delta+'. tol: '+tol );
161161
}
162162
}
163163
t.end();

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

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ tape( 'the function evaluates the logitf of `x` for the interval `(0,0.25]`', op
9191
expected = small.expected;
9292
x = small.x;
9393
for ( i = 0; i < x.length; i++ ) {
94-
y = logitf( x[i] );
95-
if ( y === expected[i] ) {
96-
t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
94+
y = logitf( x[ i ] );
95+
if ( y === expected[ i ] ) {
96+
t.equal( y, expected[ i ], 'x: '+x[ i ]+', y: '+y+', expected: '+expected[ i ] );
9797
} else {
98-
delta = absf( y - expected[i] );
99-
tol = EPS * absf( expected[i] );
100-
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. v: '+y+'. E: '+expected[i]+' Δ: '+delta+'. tol: '+tol );
98+
delta = absf( y - expected[ i ] );
99+
tol = EPS * absf( expected[ i ] );
100+
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. v: '+y+'. E: '+expected[ i ]+' Δ: '+delta+'. tol: '+tol );
101101
}
102102
}
103103
t.end();
@@ -114,13 +114,13 @@ tape( 'the function evaluates the logitf of `x` for the interval `[0.25,0.49]`',
114114
expected = mediumBelow.expected;
115115
x = mediumBelow.x;
116116
for ( i = 0; i < x.length; i++ ) {
117-
y = logitf( x[i] );
118-
if ( y === expected[i] ) {
119-
t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
117+
y = logitf( x[ i ] );
118+
if ( y === expected[ i ] ) {
119+
t.equal( y, expected[ i ], 'x: '+x[ i ]+', y: '+y+', expected: '+expected[ i ] );
120120
} else {
121-
delta = absf( y - expected[i] );
122-
tol = EPS * 15 * absf( expected[i] );
123-
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. v: '+y+'. E: '+expected[i]+' Δ: '+delta+'. tol: '+tol );
121+
delta = absf( y - expected[ i ] );
122+
tol = EPS * 15 * absf( expected[ i ] );
123+
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. v: '+y+'. E: '+expected[ i ]+' Δ: '+delta+'. tol: '+tol );
124124
}
125125
}
126126
t.end();
@@ -137,13 +137,13 @@ tape( 'the function evaluates the logitf of `x` for the interval `[0.5,0.75]`',
137137
expected = mediumAbove.expected;
138138
x = mediumAbove.x;
139139
for ( i = 0; i < x.length; i++ ) {
140-
y = logitf( x[i] );
141-
if ( y === expected[i] ) {
142-
t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
140+
y = logitf( x[ i ] );
141+
if ( y === expected[ i ] ) {
142+
t.equal( y, expected[ i ], 'x: '+x[ i ]+', y: '+y+', expected: '+expected[ i ] );
143143
} else {
144-
delta = absf( y - expected[i] );
145-
tol = EPS * 15 * absf( expected[i] );
146-
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. v: '+y+'. E: '+expected[i]+' Δ: '+delta+'. tol: '+tol );
144+
delta = absf( y - expected[ i ] );
145+
tol = EPS * 15 * absf( expected[ i ] );
146+
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. v: '+y+'. E: '+expected[ i ]+' Δ: '+delta+'. tol: '+tol );
147147
}
148148
}
149149
t.end();
@@ -160,13 +160,13 @@ tape( 'the function evaluates the logitf of `x` for the interval `[0.75,1)`', op
160160
expected = large.expected;
161161
x = large.x;
162162
for ( i = 0; i < x.length; i++ ) {
163-
y = logitf( x[i] );
164-
if ( y === expected[i] ) {
165-
t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
163+
y = logitf( x[ i ] );
164+
if ( y === expected[ i ] ) {
165+
t.equal( y, expected[ i ], 'x: '+x[ i ]+', y: '+y+', expected: '+expected[ i ] );
166166
} else {
167-
delta = absf( y - expected[i] );
168-
tol = EPS * absf( expected[i] );
169-
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. v: '+y+'. E: '+expected[i]+' Δ: '+delta+'. tol: '+tol );
167+
delta = absf( y - expected[ i ] );
168+
tol = EPS * absf( expected[ i ] );
169+
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. v: '+y+'. E: '+expected[ i ]+' Δ: '+delta+'. tol: '+tol );
170170
}
171171
}
172172
t.end();

0 commit comments

Comments
 (0)