www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4691] New: Incorrect comparison of double and long

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4691

           Summary: Incorrect comparison of double and long
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bugzilla digitalmars.com


--- Comment #0 from Walter Bright <bugzilla digitalmars.com> 2010-08-20
12:15:45 PDT ---
import std.c.stdio;

struct UN
{
   double         dd;
   long  ll;
}

string cmp( UN * pU )
{
   return pU.dd >= pU.ll ? "OK" : "ERRROR";
}

int main()
{
   static UN u = { 10.50, 10 };
   printf( "%.*s\n", cmp( &u ) );
   return 0;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 20 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4691


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc


--- Comment #1 from bearophile_hugs eml.cc 2010-08-20 13:06:56 PDT ---
Reduced test case:


double d = 1.5;
long l = 1;
void main() {
    assert(d >= l);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 20 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4691


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #2 from Walter Bright <bugzilla digitalmars.com> 2010-08-21
16:51:55 PDT ---
http://www.dsource.org/projects/dmd/changeset/622

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 21 2010