[Issue 18290] std.conv.parse throws ConvOverflowException for negative values in hex

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 16 14:48:03 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=18290

--- Comment #6 from Răzvan Ștefănescu <rumbu at rumbu.ro> ---
In my opinion, you are mixing decimal math with two's complement math. Having a
sign before a hexadecimal representation which already has the sign bit set is
pure nonsense.

Conversion between string and integrals (and vice versa) must render exact
results.

As long as to!string(int.min, 16)  returns "80000000", I expect that
parse!int("80000000", 16) to return int.min.

In conclusion, please keep my original issue as is, if you want negative hex
numbers, open another issue, don't adjust that one.

Thanks.

--


More information about the Digitalmars-d-bugs mailing list