iota to array

Steven Schveighoffer schveiguy at yahoo.com
Sun Feb 25 14:52:19 UTC 2018


On 2/25/18 8:33 AM, psychoticRabbit wrote:
> On Sunday, 25 February 2018 at 12:13:31 UTC, Andrea Fontana wrote:
>> On Sunday, 25 February 2018 at 09:30:12 UTC, psychoticRabbit wrote:
>>> I would have preffered it defaulted java style ;-)
>>>
>>> System.out.println(1.0); // i.e. it prints 'what I told it to print'.
>>
>> System.out.println(1.0); // print 1.0
>> System.out.println(1.00000); // print 1.0
>>
>> So it doesn't print "what you told it to print"
>>
>> Andrea Fontana
> 
> can someone please design a language that does what I tell it!
> 
> please!!
> 
> is that so hard??
> 
> print 1.0 does not mean go and print 1 .. it means go and print 1.0
> 

1 == 1.0, no?

You are printing a value, which means it has to go through a conversion 
from the value to a string (i.e. printable). writefln has no idea what 
you wrote as a literal, it just sees the value 1 (as a double). I hope 
we never make a distinction here!

If you want to tell it EXACTLY what to print, print a string:

writeln("1.0");

-Steve


More information about the Digitalmars-d-learn mailing list