Skip to content

Commit e93a2c6

Browse files
🐛 fix(parse_fixed_point): Handle case where integral + transient is 0.
1 parent cc64791 commit e93a2c6

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/_parse_fixed_point.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function _parse_fixed_point ( { _chr , reg , sub } ) {
1818
(new Array(transient.length+1)).join( _chr(0) ) ;
1919

2020
const _big = _integral + transient + _repetend ;
21-
const _small = _integral + transient ;
21+
const _small = ( _integral + transient ) || '0' ;
2222

2323
const _bign = reg(_big, base) ;
2424
const _smalln = reg(_small, base) ;

test/src/core.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ const PARAMS = [
256256
[ parse_fixed_point , 10 , '3.|1415929203539823008849557522123893805309734513274336283185840707964601769911504424778761061946902654867256637168' , '355/113' ] ,
257257

258258
[ parse_fixed_point , 10 , '0.0|2' , '1/45' ] ,
259+
[ parse_fixed_point , 10 , '0.|142857' , '1/7' ] ,
259260

260261
] ;
261262

0 commit comments

Comments
 (0)