← Back to index
|
Original Bugzilla link
Bug 4691 – Incorrect comparison of double and long
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2010-08-20T12:15:00Z
Last change time
2015-06-09T05:11:44Z
Keywords
wrong-code
Assigned to
nobody
Creator
bugzilla
Comments
Comment #0
by bugzilla — 2010-08-20T12:15:45Z
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; }
Comment #1
by bearophile_hugs — 2010-08-20T13:06:56Z
Reduced test case: double d = 1.5; long l = 1; void main() { assert(d >= l); }
Comment #2
by bugzilla — 2010-08-21T16:51:55Z
http://www.dsource.org/projects/dmd/changeset/622