I am using the jsbn library to manage BigIntegers in a javascript application. It seems that the negate function is not working well.
I expect that the negate function works like the Java one.
BigInteger minusOne = BigInteger.ONE.negate(); // -1
But with the jsbn library the following code produce this result...
var BigInteger = require('jsbn').BigInteger;
var bi = BigInteger.ONE;
console.log(bi); // 1
console.log(bi.negate()); // 268435455 but should be -1, no ??
You can try this code here https://runkit.com/gikoo/jsbn-negate-function/1.0.0