We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 724ed9c commit 85b7d83Copy full SHA for 85b7d83
src/_limits.js
@@ -2,4 +2,4 @@
2
export const MAX_NUMBER = Math.pow(2,53) - 1 ;
3
export const MIN_NUMBER = -Math.pow(2,53) ;
4
export const MIN_BASE = 2 ;
5
-export const MAX_BASE = Math.ceil(Math.sqrt(MAX_NUMBER+1)) | 0;
+export const MAX_BASE = Math.floor(Math.sqrt(MAX_NUMBER+1)) | 0;
test/src/integer/bugs/mul.js
@@ -0,0 +1,12 @@
1
+import test from 'ava' ;
+
+import { parse , stringify , mul } from '../../../../src' ;
+test ( 'mul handles overflow' , t => {
6
+ const X = '81129639699425365877808850315535' ;
7
+ const expected = '6582018437758576371414942707515558118625242782831331069062336225'
8
+ const x = parse( X ) ;
9
+ const r = mul( x , x ) ;
10
+ t.is( X , stringify( x ) ) ;
11
+ t.is( expected , stringify( r ) ) ;
12
+} )
0 commit comments