Andrej Mitrovic <[email protected]> wrote:
I found this by accident:
import std.stdio;
import std.conv;
void main()
{
writeln(to!string(2, 2)); // writes 10
writeln(to!string(1, 0)); // std.conv.ConvException: Radix error
}
I'm not sure why "std.conv.to" would even take multiple arguments.
Bugzilla?
The second parameter is (as indicated by the exception) the radix[1].
With a radix of 2, 2 is written 10, as radix is binary. Radix 0 makes
no sense, and thus gives an exception.
It could be said though, that std.conv's documentation is confusing
at best, and this could be worth putting in Bugzilla.
[1]:
http://en.wikipedia.org/wiki/Radix#Bases_and_positional_numeral_systems
--
Simen