www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - float number parse bug?

reply "Ilya Zaitseff" <sark7 mail333.com> writes:
[DMD 0.106]

<fparsebug.d>
import std.stdio;

void main()
{
   float a = .1.234;
   writefln(a); // outputs 0.1
}
Nov 21 2004
next sibling parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Ilya Zaitseff wrote:

<fparsebug.d>
 import std.stdio;
 
 void main()
 {
   float a = .1.234;
   writefln(a); // outputs 0.1
 }
Looks like a D bug... gdc also happily outputs 0.1 This corresponding C code: <fparsebug.c>
 #include <stdio.h>
 
 int main()
 {
   float a = .1.234;
   printf("%f\n",a);
   return 0;
 } 
Gives an error with gcc:
 fparsebug.c:5:13: too many decimal points in number
Which seems like a better response ? --anders
Nov 21 2004
prev sibling parent Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
Added to DStress as:
http://svn.kuehne.cn/dstress/nocompile/float_litaeral_dec_12.d
..
http://svn.kuehne.cn/dstress/nocompile/float_litaeral_dec_17.d

Thomas

Ilya Zaitseff schrieb am Sun, 21 Nov 2004 22:50:16 +1000:
 [DMD 0.106]

<fparsebug.d>
 import std.stdio;

 void main()
 {
    float a = .1.234;
    writefln(a); // outputs 0.1
 }
Nov 22 2004