Bug 788 – Compiler rejects hex floats in the format: HexPrefix HexDigits . HexDigits(opt) with binary-exponent-part required

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2007-01-02T21:43:00Z
Last change time
2015-10-04T18:18:48Z
Keywords
rejects-valid, spec
Assigned to
bugzilla
Creator
dlang-bugzilla

Comments

Comment #0 by dlang-bugzilla — 2007-01-02T21:43:18Z
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
Comment #1 by witold.baryluk+d — 2007-01-10T14:16:28Z
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
Comment #2 by bugzilla — 2007-02-02T21:42:15Z
The hex exponent is required. I'll fix the doc.
Comment #3 by bugzilla — 2007-02-12T03:36:02Z
Fixed DMD 1.005
Comment #4 by github-bugzilla — 2015-07-07T11:34:26Z
Commit pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/fda62efe0f526e8272dfcc47a4cc7c68f5419569 Ignore real pad in core.internal.convert unittest Change unittest to ignore any pad bytes in a floating point type because those bits are undefined. Fixes test part of ldc issue #788.
Comment #5 by github-bugzilla — 2015-10-04T18:18:48Z