literals

so so at so.do
Sun Mar 28 11:58:42 PDT 2010


Hello Don, finally!

It is hard to explain yourself when you don't know the people you talk  
have numeric coding background.
Since we know you have done much numeric and generic coding, it will be  
enough for me if you understand what i mean/ask/want,
and say what i am talking is ridiculous, or think that i am trolling, just  
say so and i shut up! :)

Thanks.

On Sun, 28 Mar 2010 23:34:43 +0400, Don <nospam at nospam.com> wrote:

> so wrote:
>> What is interesting about it is, DMD already has the solution, and it  
>> is there, implemented!
>>  Just check the page :
>> http://www.digitalmars.com/d/2.0/float.html
>>  Read the constant folding.
>> If you already have this capabilities, why limit the user?
>
> It's a bit surprising how D treats numeric literals. Although (say) 2.1  
> is of type double, 2.1f is of type float, and 2.1L is of type real, they  
> all have exactly the same value.  (Not entirely true. Oddly, the maximum  
> exponent value does seem to be limited. I think that's something which  
> should change, as I don't think it makes much sense).
> The type only affects the type of expressions involving that value, it  
> doesn't change the value.
>
> Range propagation isn't fully implemented in DMD2 yet. Once it's in, the  
>   situation will improve a little more. It's already much better than  
> the situation in C or C++. But I agree that it's still not perfect.
>
>> C was a great language but lets get over with this backward-support  
>> paranoia. :)
>>  Thanks.
>>  On Sun, 28 Mar 2010 15:02:25 +0400, so <so at so.do> wrote:
>>
>>> Hello, after a little discussion on D.learn, i better ask this here  
>>> since i didn't get much replies.
>>> Two lil questions.
>>>
>>> Why "3" is an int?
>>> Why "0.3" is a double?
>>>
>>> Thanks!
>>>
>>


-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/



More information about the Digitalmars-d mailing list