iota to array

rumbu rumbu at rumbu.ro
Sun Feb 25 08:46:19 UTC 2018


On Sunday, 25 February 2018 at 08:08:30 UTC, psychoticRabbit 
wrote:
>
>
> But umm.... what happended to the principle of least 
> astonishment?
>
> writeln(1.1); (prints 1.1)
> whereas..
> writeln(1.0); (prints 1)
>
> I don't get it. Cause it's 'nicer'??
>

Because writeln(someFloat) is equivalent to writefln("%g", 
someFloat). And according to printf specification, "trailing 
zeros are removed from the fractional part of the result; a 
decimal point appears only if it is followed by at least one 
digit"



More information about the Digitalmars-d-learn mailing list