nim-lang / bigints

BigInts for Nim
MIT License
124 stars 32 forks source link

initBigInt converts minus sign "-" to zero. #116

Closed calroc closed 2 years ago

calroc commented 2 years ago

If you convert a string consisting of a single minus sign to a BigInt you get zero.

import bigints

let x = "-".initBigInt

echo x

This program prints

0
pietroppeter commented 2 years ago

Indeed such a case should raise a ValueError.

I think this is fixed by this commit from 6 months ago but this is not probably yet in a release: https://github.com/nim-lang/bigints/commit/b96c3216cfb565b4b13570870f823aaa2dcbbffc

calroc commented 2 years ago

Yes, that would cover it. Cheers!