www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - DecimalFloat

reply "Unknown W. Brackets" <unknown simplemachines.org> writes:
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]
Mar 04 2006
next sibling parent "Chris Miller" <chris dprogramming.com> writes:
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.
Mar 04 2006
prev sibling next sibling parent "Unknown W. Brackets" <unknown simplemachines.org> writes:
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
Mar 04 2006
prev sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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 -----BEGIN PGP SIGNATURE----- iD8DBQFEEK7t3w+/yD4P9tIRAkxoAJ0bSFi7JeME7Fs8oQGOAsvL0UqsGwCgx3Qq o6g5X/T0R8Y7xDF+/uvd87s= =Zi23 -----END PGP SIGNATURE-----
Mar 09 2006