Thread overview
[Issue 788] New: Compiler rejects hex floats in the format: HexPrefix HexDigits . HexDigits(opt) with binary-exponent-part required
Jan 03, 2007
d-bugmail
Jan 10, 2007
d-bugmail
Feb 03, 2007
d-bugmail
January 03, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=788

           Summary: Compiler rejects hex floats in the format: HexPrefix
                    HexDigits . HexDigits(opt) with binary-exponent-part
                    required
           Product: D
           Version: 0.178
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid, spec
          Severity: normal
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: thecybershadow@gmail.com


Spec: http://www.digitalmars.com/d/lex.html#floatliteral

Program:

void main()
{
  float f1 = 0x0.;
  float f2 = 0x1.5;
  float f3 = 0x.5;
}

Compiler output:

C:\...\bugs>dmd hexfloat.d
hexfloat.d(3): binary-exponent-part required
hexfloat.d(4): binary-exponent-part required
hexfloat.d(5): binary-exponent-part required


-- 

January 10, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=788





------- Comment #1 from baryluk@mpi.int.pl  2007-01-10 14:16 -------
There is also another problem with HexFloat:

0x10f

Is this float (0x10)f, or double (0x10f)?

If, binary-exponent-part is really required, then spec is outdated, and there
is no problem:
0x10p0f       // float
0x10fp0       // double

"Hexadecimal floats are preceded with a 0x and the exponent is a p or P followed by a decimal number serving as the exponent of 2."

so lexer grammar should be:

HexFloat:
        HexPrefix HexDigits . HexDigits HexExponent
        HexPrefix . HexDigits HexExponent
        HexPrefix HexDigits HexExponent


-- 

February 03, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=788





------- Comment #2 from bugzilla@digitalmars.com  2007-02-02 21:42 -------
The hex exponent is required. I'll fix the doc.


--