Menu

#42 GDC not handling floats correctly

open
nobody
None
7
2008-04-02
2008-04-02
revcompgeek
No

When compiling the following code:
module floattest;

import tango.io.Stdout;

void main(){
float x = 3.14;
double y = 3.14;
Stdout(x).newline;
Stdout(y).newline;
Stdout(cast(double)x).newline;
}

and running it, the following output is produced:

2.14
3.14
3.14

This is not a problem with Tango, because tango users using dmd do not have this problem. I am on Mac OS 10.4 using the latest gdcmac distribution.

Discussion

  • revcompgeek

    revcompgeek - 2008-04-02
    • priority: 5 --> 7
     
  • Valeriu Palos

    Valeriu Palos - 2008-04-10

    Logged In: YES
    user_id=1286246
    Originator: NO

    I tried this and got mixed results for 32bit and 64bit.

    On 32bit architecture (Ubuntu Hardy i386):
    3.68e+19
    3.14
    3.14

    On 64bit architecture (Ubuntu Hardy amd64):
    3.14
    3.14
    3.14

    So it seems to to the right job when gdc compiles for 64bit architectures. Hmmm...

     

Log in to post a comment.

Monday.com Logo