File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 2
2
export const MAX_NUMBER = Math . pow ( 2 , 53 ) - 1 ;
3
3
export const MIN_NUMBER = - Math . pow ( 2 , 53 ) ;
4
4
export const MIN_BASE = 2 ;
5
- export const MAX_BASE = Math . ceil ( Math . sqrt ( MAX_NUMBER + 1 ) ) | 0 ;
5
+ export const MAX_BASE = Math . floor ( Math . sqrt ( MAX_NUMBER + 1 ) ) | 0 ;
Original file line number Diff line number Diff line change
1
+ import test from 'ava' ;
2
+
3
+ import { parse , stringify , mul } from '../../../../src' ;
4
+
5
+ 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
+ } )
You can’t perform that action at this time.
0 commit comments