File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
lib/node_modules/@stdlib/math/base/special/binomcoeff/test Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 23
23
var tape = require ( 'tape' ) ;
24
24
var isnanf = require ( '@stdlib/math/base/assert/is-nanf' ) ;
25
25
var absf = require ( '@stdlib/math/base/special/absf' ) ;
26
+ var PINF = require ( '@stdlib/constants/float32/pinf' ) ;
26
27
var EPS = require ( '@stdlib/constants/float32/eps' ) ;
27
28
var float64ToFloat32 = require ( '@stdlib/number/float64/base/to-float32' ) ;
28
29
var binomcoeff = require ( './../lib' ) ;
@@ -128,3 +129,18 @@ tape( 'the function returns `0` when `k` is greater than `n`', function test( t
128
129
t . strictEqual ( v , 0.0 , 'returns expected value' ) ;
129
130
t . end ( ) ;
130
131
} ) ;
132
+
133
+ tape ( 'the function returns `+infinity` for large binomial coefficients that overflow' , function test ( t ) {
134
+ var v ;
135
+
136
+ v = binomcoeff ( 140 , 70 ) ;
137
+ t . strictEqual ( v , PINF , 'returns expected value' ) ;
138
+
139
+ v = binomcoeff ( 150 , 75 ) ;
140
+ t . strictEqual ( v , PINF , 'returns expected value' ) ;
141
+
142
+ v = binomcoeff ( 200 , 100 ) ;
143
+ t . strictEqual ( v , PINF , 'returns expected value' ) ;
144
+
145
+ t . end ( ) ;
146
+ } ) ;
You can’t perform that action at this time.
0 commit comments