iota to array
psychoticRabbit
meagain at meagain.com
Sun Feb 25 09:30:12 UTC 2018
On Sunday, 25 February 2018 at 08:46:19 UTC, rumbu wrote:
> 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"
oh. that explains it.
I would have preffered it defaulted java style ;-)
System.out.println(1.0); // i.e. it prints 'what I told it to
print'.
More information about the Digitalmars-d-learn
mailing list