Hex floats

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Feb 15 13:24:13 PST 2012


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?

Also, the specs say:

	FloatLiteral:
		Float
		Float Suffix
		...

	Float:
		DecimalFloat
		HexFloat

	Suffix:
		FloatSuffix
		...

	FloatSuffix:
		f
		F

This is ambiguous, since you could interpret 0xFFp0F as either 0xFFp0
followed by the suffix 'F', or 0xFFp0F with an exponent of 0x0F no
suffix.


T

-- 
It is widely believed that reinventing the wheel is a waste of time; but
I disagree: without wheel reinventers, we would be still be stuck with
wooden horse-cart wheels.


More information about the Digitalmars-d-learn mailing list