Thread overview
DecimalFloat
Mar 04, 2006
Chris Miller
Mar 09, 2006
Thomas Kuehne
March 04, 2006
The documentation currently describes DecimalFloat as:

DecimalFloat:
	DecimalDigits .
	DecimalDigits . DecimalDigits
	DecimalDigits . DecimalDigits DecimalExponent
	. DecimalDigits
	. DecimalDigits DecimalExponent
	DecimalDigits DecimalExponent

I believe this is incorrect.  It should be, by my reasoning:

DecimalFloat:
	DecimalDigits .
	DecimalDigits . DecimalDigits
	DecimalDigits . DecimalDigits DecimalExponent
	. Decimal
	. Decimal DecimalExponent
	DecimalDigits DecimalExponent

The reason I believe this to be is simple.  Try the following code:

writefln(._1);

According to the previous definition of DecimalFloat (as far as I read it), that should be equivalent to:

writefln(.1);

However, it instead generates an error with DMD.  I think this makes the most sense, and serves to clarify that this:

writefln(._);

Is also not a FloatLiteral (which I think is pretty clear.)

Thanks,
-[Unknown]
March 04, 2006
On Sat, 04 Mar 2006 16:46:55 -0500, Unknown W. Brackets <unknown@simplemachines.org> wrote:

> The documentation currently describes DecimalFloat as:
>
> DecimalFloat:
> 	DecimalDigits .
> 	DecimalDigits . DecimalDigits
> 	DecimalDigits . DecimalDigits DecimalExponent
> 	. DecimalDigits
> 	. DecimalDigits DecimalExponent
> 	DecimalDigits DecimalExponent
>
> I believe this is incorrect.  It should be, by my reasoning:
>
> DecimalFloat:
> 	DecimalDigits .
> 	DecimalDigits . DecimalDigits
> 	DecimalDigits . DecimalDigits DecimalExponent
> 	. Decimal
> 	. Decimal DecimalExponent
> 	DecimalDigits DecimalExponent
>
> The reason I believe this to be is simple.  Try the following code:
>
> writefln(._1);
>
> According to the previous definition of DecimalFloat (as far as I read it), that should be equivalent to:
>
> writefln(.1);
>
> However, it instead generates an error with DMD.  I think this makes the most sense, and serves to clarify that this:
>
> writefln(._);
>
> Is also not a FloatLiteral (which I think is pretty clear.)
>
> Thanks,
> -[Unknown]

You are right ._1 and ._ cannot be floats, it's accessing identifiers _1 and _ from the global scope.
March 05, 2006
I'm sorry, I was really reporting the problem with ._1, etc. but I misrepresented what I meant; this is only better.  Perhaps it really should be:

DecimalFloat:
	Decimal .
	Decimal . DecimalDigits
	Decimal . DecimalDigits DecimalExponent
	. Decimal
	. Decimal DecimalExponent
	Decimal DecimalExponent

Since really, "_1.1" shouldn't compile either.  Sorry about that.

This seems to more or less fit the rules DMD actually follows currently.

-[Unknown]


> I believe this is incorrect.  It should be, by my reasoning:
> 
> DecimalFloat:
>     DecimalDigits .
>     DecimalDigits . DecimalDigits
>     DecimalDigits . DecimalDigits DecimalExponent
>     . Decimal
>     . Decimal DecimalExponent
>     DecimalDigits DecimalExponent
March 09, 2006
Unknown W. Brackets schrieb am 2006-03-04:
> The documentation currently describes DecimalFloat as:
>
> DecimalFloat:
> 	DecimalDigits .
> 	DecimalDigits . DecimalDigits
> 	DecimalDigits . DecimalDigits DecimalExponent
> 	. DecimalDigits
> 	. DecimalDigits DecimalExponent
> 	DecimalDigits DecimalExponent
>
> I believe this is incorrect.  It should be, by my reasoning:
>
> DecimalFloat:
> 	DecimalDigits .
> 	DecimalDigits . DecimalDigits
> 	DecimalDigits . DecimalDigits DecimalExponent
> 	. Decimal
> 	. Decimal DecimalExponent
> 	DecimalDigits DecimalExponent
>
> The reason I believe this to be is simple.  Try the following code:
>
> writefln(._1);
>
> According to the previous definition of DecimalFloat (as far as I read it), that should be equivalent to:
>
> writefln(.1);
>
> However, it instead generates an error with DMD.  I think this makes the most sense, and serves to clarify that this:
>
> writefln(._);
>
> Is also not a FloatLiteral (which I think is pretty clear.)

Added to DStress as http://dstress.kuehne.cn/undefined/float_literal_01_A.d http://dstress.kuehne.cn/undefined/float_literal_01_B.d http://dstress.kuehne.cn/undefined/float_literal_01_C.d http://dstress.kuehne.cn/undefined/float_literal_01_D.d

Thomas