File tree 2 files changed +18
-3
lines changed
2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -218,19 +218,19 @@ export class Integer {
218
218
219
219
ipown ( number ) {
220
220
// TODO optimize but be careful with side effects
221
- return this . pown ( other ) . move ( this ) ;
221
+ return this . pown ( number ) . move ( this ) ;
222
222
}
223
223
224
224
square ( ) {
225
225
// TODO optimize but be careful with side effects
226
226
// TODO use this.mul(this) instead?
227
- return this . pow ( 2 ) ;
227
+ return this . pown ( 2 ) ;
228
228
}
229
229
230
230
isquare ( ) {
231
231
// TODO optimize but be careful with side effects
232
232
// TODO use this.imul(this) instead?
233
- return this . ipow ( 2 ) ;
233
+ return this . ipown ( 2 ) ;
234
234
}
235
235
236
236
div ( other ) {
Original file line number Diff line number Diff line change
1
+ import test from 'ava' ;
2
+ import { ZZ } from '../../../src' ;
3
+
4
+ function number ( t , x ) {
5
+ t . is ( x * x , ZZ . from ( x ) . isquare ( ) . valueOf ( ) ) ;
6
+ }
7
+
8
+ number . title = ( providedTitle , x ) => `${ x } ^2 = ${ x * x } ` ;
9
+
10
+ test ( number , - 1 ) ;
11
+ test ( number , 0 ) ;
12
+ test ( number , 1 ) ;
13
+ test ( number , 2 ) ;
14
+ test ( number , 777 ) ;
15
+ test ( number , - 17321983 ) ;
You can’t perform that action at this time.
0 commit comments