Thread overview
float number parse bug?
Nov 21, 2004
Ilya Zaitseff
Nov 22, 2004
Thomas Kuehne
November 21, 2004
[DMD 0.106]

<fparsebug.d>
import std.stdio;

void main()
{
  float a = .1.234;
  writefln(a); // outputs 0.1
}
November 21, 2004
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
November 22, 2004

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
> }