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 <s...@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!



Reply via email to