peterolson / BigInteger.js

An arbitrary length integer library for Javascript
The Unlicense
1.12k stars 187 forks source link

Method - bitwise meaning #116

Closed courteous closed 6 years ago

courteous commented 6 years ago

can you please explain what this line exactly in the method bitwise is supposed to do?

var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0);

thanks

Yaffle commented 6 years ago

sometimes, -2**k should be subtracted from the result to simulate 2s complement representation

courteous commented 6 years ago

thanks