fromString with a string that isn't an integer behaves weird
parbo opened this issue · comments
var Long = require("long");
var s = Long.fromString(String(1.1 * 100));
console.log("Long.fromString(..):", s);
console.log("Long.toString(..):", s.toString());
Outputs:
Long.fromString(..): Long { low: 488372225, high: 256, unsigned: false }
Long.toString(..): 1100000000001
Another example:
var Long = require("long");
var s = Long.fromString("123 7 8 9");
console.log("Long.fromString(..):", s);
console.log("Long.toString(..):", s.toString());
Outputs:
Long.fromString(..): Long { low: 1239, high: 0, unsigned: false }
Long.toString(..): 1239
I'd expect both of these to throw.