On 02/17/2012 10:45 AM, Don Clugston wrote:
On 16/02/12 17:36, Timon Gehr wrote:
On 02/16/2012 05:06 PM, Don Clugston wrote:
On 16/02/12 13:28, Stewart Gordon wrote:
On 16/02/2012 12:04, Don Clugston wrote:
On 15/02/12 22:24, H. S. Teoh wrote:
What's the original rationale for requiring that hex float literals
must
always have an exponent? For example, 0xFFi obviously must be float,
not
integer, so why does the compiler (and the spec) require an exponent?

The syntax comes from C99.

Do you mean the syntax has just been copied straight from C99 without
any thought about making it more lenient?

Stewart.

Yes. There would need to be a good reason to do so.

For the case in question, note that mathematically, imaginary integers
are perfectly valid. Would an imaginary integer literal be an idouble, a
ifloat, or an ireal? I don't think it could be any:

foor(float x)
foor(double x)
fooi(ifloat x)
fooi(idouble x)

foor(7); //ambiguous, doesn't compile
fooi(7i); // by symmetry, this shouldn't compile either

static assert(is(typeof(7i)==idouble));

Ooh, that's bad.


Indeed. But the implementation of complex and imaginary numbers is pretty much broken in the front-end anyway. For example, double and idouble are type combined to double iirc.

Reply via email to