On Thursday, 3 September 2015 at 12:51:42 UTC, Namal wrote:
Interesting, in contrary to C++ it saves the integral part in the dummy variable. Doing this I noticed if I try to write a double variable in the console it gives me only the integral part. I only did it with writeln so far. How can I print out a double variable with a precision of 2 for instance? I tried it with writefln("%d", d)
It compiles but crashes.

I believe .2 will print it precision two.
writefln("%.2s", d)

More info here:
   http://dlang.org/phobos/std_format.html#formattedWrite

Reply via email to