Skip to content

Commit f67f8c3

Browse files
chores
1 parent 24bacc7 commit f67f8c3

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var isIntegerf = require( '@stdlib/math/base/assert/is-integerf' );
2525
var gamma = require( '@stdlib/math/base/special/gamma' );
2626
var PINF = require( '@stdlib/constants/float32/pinf' );
2727
var FLOAT32_MAX_NTH_FACTORIAL = require( '@stdlib/constants/float32/max-nth-factorial' );
28-
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
28+
var f32 = require( '@stdlib/number/float64/base/to-float32' );
2929
var FACTORIALS = require( './factorials.json' );
3030

3131

@@ -70,7 +70,7 @@ var FACTORIALS = require( './factorials.json' );
7070
* // returns NaN
7171
*/
7272
function factorialf( x ) {
73-
x = float64ToFloat32( x );
73+
x = f32( x );
7474
if ( isnanf( x ) ) {
7575
return NaN;
7676
}
@@ -79,11 +79,11 @@ function factorialf( x ) {
7979
return NaN;
8080
}
8181
if ( x <= FLOAT32_MAX_NTH_FACTORIAL ) {
82-
return float64ToFloat32( FACTORIALS[ x|0 ] );
82+
return f32( FACTORIALS[ x|0 ] );
8383
}
8484
return PINF;
8585
}
86-
return float64ToFloat32( gamma( x + 1.0 ) );
86+
return f32( gamma( x + 1.0 ) );
8787
}
8888

8989

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
var tape = require( 'tape' );
2424
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
2525
var incrspace = require( '@stdlib/array/base/incrspace' );
26-
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
26+
var f32 = require( '@stdlib/number/float64/base/to-float32' );
2727
var isAlmostSameValue = require( '@stdlib/number/float32/base/assert/is-almost-same-value' );
2828
var PINF = require( '@stdlib/constants/float32/pinf' );
2929
var NINF = require( '@stdlib/constants/float32/ninf' );
@@ -101,7 +101,7 @@ tape( 'the function evaluates the factorial function (positive integers < 35)',
101101
continue;
102102
}
103103
v = factorialf( x[ i ] );
104-
t.strictEqual( isAlmostSameValue( v, float64ToFloat32( expected[ i ] ), 1 ), true, 'returns expected value when provided ' + x[ i ] + '. Value: ' + v + '. Expected: ' + expected[ i ] + '.' );
104+
t.strictEqual( isAlmostSameValue( v, f32( expected[ i ] ), 1 ), true, 'returns expected value when provided ' + x[ i ] + '. Value: ' + v + '. Expected: ' + expected[ i ] + '.' );
105105
}
106106
t.end();
107107
});
@@ -127,18 +127,18 @@ tape( 'the function evaluates the factorial function (decimal values)', function
127127
for ( i = 0; i < x.length; i++ ) {
128128
v = factorialf( x[ i ] );
129129
if ( isnanf( v ) ) {
130-
t.strictEqual( isnanf( v ), isnanf( float64ToFloat32( expected[ i ] ) ), 'returns NaN for x='+x[i] );
130+
t.strictEqual( isnanf( v ), isnanf( f32( expected[ i ] ) ), 'returns NaN for x='+x[i] );
131131
continue;
132132
}
133133
if ( v === PINF ) {
134134
t.strictEqual( v, PINF, 'returns Infinity for x='+x[i] );
135135
continue;
136136
}
137-
if ( v === 0.0 && float64ToFloat32( expected[ i ] ) === 0.0 ) {
137+
if ( v === 0.0 && f32( expected[ i ] ) === 0.0 ) {
138138
t.strictEqual( v, 0.0, 'returns 0.0 for x=' + x[ i ] );
139139
continue;
140140
}
141-
t.strictEqual( isAlmostSameValue( v, float64ToFloat32( expected[ i ] ), 3000 ), true, 'within tolerance. x: ' + x[ i ] + '. Value: ' + v + '. Expected: ' + expected[ i ] + '.' );
141+
t.strictEqual( isAlmostSameValue( v, f32( expected[ i ] ), 3000 ), true, 'within tolerance. x: ' + x[ i ] + '. Value: ' + v + '. Expected: ' + expected[ i ] + '.' );
142142
}
143143
t.end();
144144
});

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var resolve = require( 'path' ).resolve;
2424
var tape = require( 'tape' );
2525
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
2626
var incrspace = require( '@stdlib/array/base/incrspace' );
27-
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
27+
var f32 = require( '@stdlib/number/float64/base/to-float32' );
2828
var isAlmostSameValue = require( '@stdlib/number/float32/base/assert/is-almost-same-value' );
2929
var PINF = require( '@stdlib/constants/float32/pinf' );
3030
var NINF = require( '@stdlib/constants/float32/ninf' );
@@ -112,7 +112,7 @@ tape( 'the function evaluates the factorial function (positive integers < 35)',
112112
continue;
113113
}
114114
v = factorialf( x[ i ] );
115-
t.strictEqual( isAlmostSameValue( v, float64ToFloat32( expected[ i ] ), 1 ), true, 'returns expected value when provided ' + x[ i ] + '. Value: ' + v + '. Expected: ' + expected[ i ] + '.' );
115+
t.strictEqual( isAlmostSameValue( v, f32( expected[ i ] ), 1 ), true, 'returns expected value when provided ' + x[ i ] + '. Value: ' + v + '. Expected: ' + expected[ i ] + '.' );
116116
}
117117
t.end();
118118
});
@@ -138,18 +138,18 @@ tape( 'the function evaluates the factorial function (decimal values)', opts, fu
138138
for ( i = 0; i < x.length; i++ ) {
139139
v = factorialf( x[ i ] );
140140
if ( isnanf( v ) ) {
141-
t.strictEqual( isnanf( v ), isnanf( float64ToFloat32( expected[ i ] ) ), 'returns NaN for x='+x[i] );
141+
t.strictEqual( isnanf( v ), isnanf( f32( expected[ i ] ) ), 'returns NaN for x='+x[i] );
142142
continue;
143143
}
144144
if ( v === PINF ) {
145145
t.strictEqual( v, PINF, 'returns Infinity for x='+x[i] );
146146
continue;
147147
}
148-
if ( v === 0.0 && float64ToFloat32( expected[ i ] ) === 0.0 ) {
148+
if ( v === 0.0 && f32( expected[ i ] ) === 0.0 ) {
149149
t.strictEqual( v, 0.0, 'returns 0.0 for x=' + x[ i ] );
150150
continue;
151151
}
152-
t.strictEqual( isAlmostSameValue( v, float64ToFloat32( expected[ i ] ), 3000 ), true, 'within tolerance. x: ' + x[ i ] + '. Value: ' + v + '. Expected: ' + expected[ i ] + '.' );
152+
t.strictEqual( isAlmostSameValue( v, f32( expected[ i ] ), 3000 ), true, 'within tolerance. x: ' + x[ i ] + '. Value: ' + v + '. Expected: ' + expected[ i ] + '.' );
153153
}
154154
t.end();
155155
});

0 commit comments

Comments
 (0)