Thread overview
float literals
Dec 27, 2008
Ellery Newcomer
Dec 28, 2008
BCS
Dec 28, 2008
Ellery Newcomer
Dec 29, 2008
BCS
Dec 30, 2008
BCS
December 27, 2008
From the grammar,

FloatLiteral:
	Float
	Float Suffix
	Integer ImaginarySuffix
	Integer FloatSuffix ImaginarySuffix
	Integer RealSuffix ImaginarySuffix

it appears that dmd should be able to compile something like

ifloat f1 = 0b1001i; //doesn't like this
ifloat f2 = 010i; //doesn't treat this as octal
ifloat f3 = 0xFFFFi; //doesn't like this

if built in complex numbers are going away, this will become a non issue.

real r1 = 0b1001L; //does work!
real r2 = 010L; //does work!
real r3 = 0xFFFFL; //does work!

Yay!

float f4 = 0b1001F; //doesn't like this
float f5 = 010F; //doesn't like this
float f6 = 0xFFFFF; //umm....

Obviously, the F suffix introduces an ambiguity for hex. Not sure if the  others should be considered a problem.

What's the deal?
Is the grammar lying to me?
Is DMD not following spec?
Am I going crazy? (well, that's a given)

At the moment, I appear to be using dmd 1.033
December 28, 2008
Reply to Ellery,

> From the grammar,
> 
> FloatLiteral:
> Float
> Float Suffix
> Integer ImaginarySuffix
> Integer FloatSuffix ImaginarySuffix
> Integer RealSuffix ImaginarySuffix

I don't think "Integer" is referring to "IntegerLiteral". In fact, I think it is undefined.


December 28, 2008
BCS wrote:
> Reply to Ellery,
> 
>> From the grammar,
>>
>> FloatLiteral:
>> Float
>> Float Suffix
>> Integer ImaginarySuffix
>> Integer FloatSuffix ImaginarySuffix
>> Integer RealSuffix ImaginarySuffix
> 
> I don't think "Integer" is referring to "IntegerLiteral". In fact, I think it is undefined.
> 
> 
Umm.. Ok. I guess I'll just omit it from my grammar until it is defined...

At least for RealSuffix it appeared very much to be referring to IntegerLiteral
December 29, 2008
Reply to Ellery,

> BCS wrote:
> 
>> Reply to Ellery,
>> 
>>> From the grammar,
>>> 
>>> FloatLiteral:
>>> Float
>>> Float Suffix
>>> Integer ImaginarySuffix
>>> Integer FloatSuffix ImaginarySuffix
>>> Integer RealSuffix ImaginarySuffix
>> I don't think "Integer" is referring to "IntegerLiteral". In fact, I
>> think it is undefined.
>> 
> Umm.. Ok. I guess I'll just omit it from my grammar until it is
> defined...
> 
> At least for RealSuffix it appeared very much to be referring to
> IntegerLiteral
> 

As that is in lex.html I don't think it is part of the syntax but part of the lexical stuff. OTOH I seem to recall that there are some issues with FP literals vs slices ".." 


December 30, 2008
Reply to Ellery,

> BCS wrote:
> 
>> Reply to Ellery,
>> 
>>> From the grammar,
>>> 
>>> FloatLiteral:
>>> Float
>>> Float Suffix
>>> Integer ImaginarySuffix
>>> Integer FloatSuffix ImaginarySuffix
>>> Integer RealSuffix ImaginarySuffix
>> I don't think "Integer" is referring to "IntegerLiteral". In fact, I
>> think it is undefined.
>> 
> Umm.. Ok. I guess I'll just omit it from my grammar until it is
> defined...
> 
> At least for RealSuffix it appeared very much to be referring to
> IntegerLiteral
> 

As that is in lex.html I don't think it is part of the syntax but part of the lexical stuff. OTOH I seem to recall that there are some issues with FP literals vs slices ".."