@@ -137,14 +137,14 @@ export class BigFloat {
137137 /** Multiply by an integer and write output limbs to another list. */
138138
139139 private mulInt ( factor : number , dstLimbList : number [ ] , srcPos : number , dstPos : number , overwriteMask : number ) {
140+ if ( ! factor ) return ( 0 ) ;
141+
140142 let limbList = this . limbList ;
141143 let limbCount = limbList . length ;
142144 var limb : number ;
143145 var lo : number ;
144146 let carry = 0 ;
145147
146- if ( ! factor ) return ( 0 ) ;
147-
148148 // limbList is an array of 32-bit ints but split here into 16-bit low
149149 // and high words for multiplying by a 32-bit term, so the intermediate
150150 // 48-bit multiplication results fit into 53 bits of IEEE 754 mantissa.
@@ -183,15 +183,11 @@ export class BigFloat {
183183 const limbCount = limbList . length ;
184184 let out = new BigFloat ( ) ;
185185
186- out . isNegative = this . isNegative ^ factor . isNegative ;
187-
188- let carry : number ;
189- let carryPos = this . limbList . length ;
190-
191186 for ( let limbNum = 0 ; limbNum < limbCount ; ++ limbNum ) {
192187 this . mulInt ( limbList [ limbNum ] , out . limbList , 0 , limbNum , 0xffffffff ) ;
193188 }
194189
190+ out . isNegative = this . isNegative ^ factor . isNegative ;
195191 out . fractionLen = this . fractionLen + factor . fractionLen ;
196192
197193 return ( out ) ;
@@ -323,6 +319,8 @@ export class BigFloat {
323319 return ( BigFloat . trim ( digitList . join ( '' ) ) ) ;
324320 }
325321
322+ /** Remove leading and trailing insignificant zero digits. */
323+
326324 static trim ( str : string ) {
327325 return ( str
328326 . replace ( / ^ ( - ? ) 0 + ( [ 1 - 9 a - z ] | 0 ( \. | $ ) ) / , '$1$2' )
0 commit comments