float literals

Ellery Newcomer ellery-newcomer at utulsa.edu
Sat Dec 27 15:00:26 PST 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


More information about the Digitalmars-d-learn mailing list