[Issue 10215] Regression (2.063 release): const causes wrong float calculation
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri May 31 01:04:57 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10215
Tiberiu Gal <galtiberiu at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |galtiberiu at gmail.com
--- Comment #6 from Tiberiu Gal <galtiberiu at gmail.com> 2013-05-31 01:04:56 PDT ---
import std.stdio, std.math;
class Foo {
public:
const int i = 3;
auto getI(){ return i ; }
int j = 3;
auto getJ(){ return j;}
const float x = 0.4;
auto getX(){ return x; }
float y = 0.4;
auto getY(){ return y; }
}
struct Soo {
const int i = 3;
auto getI(){ return i ; }
int j = 3;
auto getJ(){ return j;}
const float x = 0.4;
auto getX(){ return x; }
float y = 0.4;
auto getY(){ return y; }
}
void main() {
writeln("with local vars");
const float x = 3.12;
const int y = 3;
writeln(x , " / " , x == 3.12);
writeln(y, " / ", y == 3);
writeln("with classes");
Foo f = new Foo();
writeln(f.x, " ", f.getX(), " / ", f.x == f.getX() );
writeln(f.y, " ", f.getY(), " / ", f.y == f.getY() );
writeln(f.i, " ", f.getI(), " / ", f.i == f.getI() );
writeln(f.j, " ", f.getJ(), " / ", f.j == f.getJ() );
writeln("now with structs");
Soo s;
writeln(s.x, " ", s.getX(), " / ", s.x == s.getX() );
writeln(s.y, " ", s.getY(), " / ", s.y == s.getY() );
writeln(s.i, " ", s.getI(), " / ", s.i == s.getI() );
writeln(s.j, " ", s.getJ(), " / ", s.j == s.getJ() );
}
// outputs
/**
with local vars
3.12 / true
3 / true
with classes
6.09598e-39 0.4 / false
0.4 0.4 / true
4350240 3 / false
3 3 / true
now with structs
4.2039e-45 0.4 / false
0.4 0.4 / true
3 3 / true
3 3 / true
*/
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list