digitalmars.D.bugs - [Issue 7376] New: floating point bug
- d-bugmail puremagic.com (63/63) Jan 27 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7376
- d-bugmail puremagic.com (14/14) Jan 27 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7376
- d-bugmail puremagic.com (12/12) Jan 27 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7376
- d-bugmail puremagic.com (12/12) Jan 27 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7376
http://d.puremagic.com/issues/show_bug.cgi?id=7376
Summary: floating point bug
Product: D
Version: D2
Platform: x86_64
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: iteronvexor gmail.com
As discussed in this thread:
http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.learn&artnum=31864
Shorter version of the bug:
import std.stdio;
void calculate1(float a, float b)
{
float s1 = 1.0f - a;
float s2 = a * b;
writeln(s2);
writeln(a * b);
}
void calculate2(float a, float b)
{
float s1 = 1.0 - a;
float s2 = a * b;
writeln(s2);
writeln(a * b);
}
void calculate3(double a, double b)
{
double s1 = 1.0 - a;
double s2 = a * b;
writeln(s2);
writeln(a * b);
}
int main()
{
writeln("calculate1:");
calculate1(0.75f,2.0f);
writeln("calculate2:");
calculate2(0.75f,2.0f);
writeln("calculate3:");
calculate3(0.75f,2.0f);
return 0;
}
-------------------------------------------------
+ The complete output
-------------------------------------------------
calculate1:
1.5
1.5
calculate2:
0
1.5
calculate3:
1.5
1.5
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 27 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7376
Walter Bright <bugzilla digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bugzilla digitalmars.com
01:40:06 PST ---
I tried this on Ubuntu Linux with the latest build:
dmd foo -O
dmd foo
dmd foo -O -inline
and could not reproduce an error. The generated code looks fine, too.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 27 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7376
Jonathan M Davis <jmdavisProg gmx.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jmdavisProg gmx.com
PST ---
I see it on 2.057 without -inline or -O (the problem seems to go away with
either of those flags), but I don't see it at all on the latest from github.
This using using 64-bit Arch Linux.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 27 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7376
Walter Bright <bugzilla digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WORKSFORME
09:23:42 PST ---
Ok, so without further evidence it is not working in the latest build, I'm
going to resolve this.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 27 2012









d-bugmail puremagic.com 