You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the radix is not 10 the conversion from and to int does produce wrong results for negative numbers
---
import std.stdio;
import std.conv;
void main()
{
foreach (i;2..17)
writeln(to!string(-1, i));
}
---
produces
---
11111111111111111111111111111111
102002022201221111210
3333333333333333
32244002423140
1550104015503
211301422353
37777777777
12068657453
-1
1904440553
9BA461593
535A79888
2CA5B7463
1A20DCD80
FFFFFFFF
---
The same for the conversion from string to int:
---
import std.stdio;
import std.conv;
void main()
{
writeln(to!int("-1", 10)); // works
writeln(to!int("-1", 11)); // ConvException
}
---
The text was updated successfully, but these errors were encountered:
bugzilla (@berni44) reported this on 2019-12-16T16:23:56Z
Transfered from https://issues.dlang.org/show_bug.cgi?id=20452
Description
The text was updated successfully, but these errors were encountered: