www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - floating-WTF

reply Caligo <iteronvexor gmail.com> writes:
alias double Real;
//alias float Real;

// simple linear interpolation; I partitioned the internals to help me
figure out what was happening.
Real lerp(Real t, Real a, Real b){
  Real s1 = (1.0 - t) * a;
  Real s2 = t * b;
  Real rt1 = s1 + s2;
  Real rt2 = ((1.0 - t) * a) + (t * b);
  writefln("t=%.2f, a=%.2f, b=%.2f, s1=%.2f, s2=%.2f, rt1=%.2f,
rt2=%.2f  :::", t, a, b, s1, s2, rt1, rt2);
  return rt2;
}

unittest{

  writeln(lerp(0.75, -2.0, 2.0));  // the correct result is 1.0
}

compile and run with 'dmd -inline -unittest' and the output should be:

t=0.75, a=-2.00, b=2.00, s1=-0.50, s2=1.50, rt1=1.00, rt2=1.00  :::
1

Now, change 'Real' to float by uncommenting the second line and
compile and run with 'dmd -unittest'.  This is what I get for the
output:

t=0.75, a=0.00, b=2.00, s1=-0.50, s2=0.00, rt1=-0.50, rt2=1.50  :::
1.5

I have no idea why 'a' is zero.  'rt1' and 'rt2' do not have the same
value, and 'lerp' does not return 1.0.  Compiling with 'dmd -inline
-unittest' does produce the correct result as before, though.

You can play with different compiler options, such as -O, to get the
same weird behavior.

I presume this is another DMD bug?
Jan 23 2012
parent reply sclytrack <sclytrack fake.com> writes:
On 01/24/2012 04:13 AM, Caligo wrote:
 alias double Real;
 //alias float Real;

 // simple linear interpolation; I partitioned the internals to help me
 figure out what was happening.
 Real lerp(Real t, Real a, Real b){
    Real s1 = (1.0 - t) * a;
    Real s2 = t * b;
    Real rt1 = s1 + s2;
    Real rt2 = ((1.0 - t) * a) + (t * b);
    writefln("t=%.2f, a=%.2f, b=%.2f, s1=%.2f, s2=%.2f, rt1=%.2f,
 rt2=%.2f  :::", t, a, b, s1, s2, rt1, rt2);
    return rt2;
 }

 unittest{

    writeln(lerp(0.75, -2.0, 2.0));  // the correct result is 1.0
 }

 compile and run with 'dmd -inline -unittest' and the output should be:

 t=0.75, a=-2.00, b=2.00, s1=-0.50, s2=1.50, rt1=1.00, rt2=1.00  :::
 1

 Now, change 'Real' to float by uncommenting the second line and
 compile and run with 'dmd -unittest'.  This is what I get for the
 output:

 t=0.75, a=0.00, b=2.00, s1=-0.50, s2=0.00, rt1=-0.50, rt2=1.50  :::
 1.5
This: (with float) writefln("t=%.2f, a=%.2f, b=%.2f, s1=%.2f, s2=%.2f, rt1=%.2f, rt2=%.2f :::", t, a, b, s1, s2, rt1, rt2); writefln("t=%.2f, a=%f, b=%.2f, s1=%.2f, s2=%.2f, rt1=%.2f, rt2=%.2f :::", t, a, b, s1, s2, rt1, rt2); Outputs: (with float) t=0.75, a=0.00, b=2.00, s1=-0.50, s2=0.00, rt1=-0.50, rt2=1.50 ::: t=0.75, a=-2.000000, b=2.00, s1=-0.50, s2=0.00, rt1=-0.50, rt2=1.50 ::: difference: %.2f ---> %f
 I have no idea why 'a' is zero.  'rt1' and 'rt2' do not have the same
 value, and 'lerp' does not return 1.0.  Compiling with 'dmd -inline
 -unittest' does produce the correct result as before, though.

 You can play with different compiler options, such as -O, to get the
 same weird behavior.

 I presume this is another DMD bug?
Jan 24 2012
parent reply sclytrack <sclytrack fake.com> writes:
t=0.750000, a=-2.000000, b=2.000000, s1=-0.500000, s2=0.000000, 
rt1=-0.500000, rt2=1.500000  :::
1.5

t = 0.75	ok
a = -2.0	ok
b = 2.0		ok
s1 = -0.5	ok
s2 = 1.5   //<----different above says s2 = 0.0
rt1= 1.0 = s1 + s2   semi-ok depends on s2.
rt2 = 1.0 = ((1.0 - t) * a) + (t * b);  goes nuts.



On 01/24/2012 10:03 AM, sclytrack wrote:
 On 01/24/2012 04:13 AM, Caligo wrote:
 alias double Real;
 //alias float Real;

 // simple linear interpolation; I partitioned the internals to help me
 figure out what was happening.
 Real lerp(Real t, Real a, Real b){
 Real s1 = (1.0 - t) * a;
 Real s2 = t * b;
 Real rt1 = s1 + s2;
 Real rt2 = ((1.0 - t) * a) + (t * b);
 writefln("t=%.2f, a=%.2f, b=%.2f, s1=%.2f, s2=%.2f, rt1=%.2f,
 rt2=%.2f :::", t, a, b, s1, s2, rt1, rt2);
 return rt2;
 }

 unittest{

 writeln(lerp(0.75, -2.0, 2.0)); // the correct result is 1.0
 }

 compile and run with 'dmd -inline -unittest' and the output should be:

 t=0.75, a=-2.00, b=2.00, s1=-0.50, s2=1.50, rt1=1.00, rt2=1.00 :::
 1

 Now, change 'Real' to float by uncommenting the second line and
 compile and run with 'dmd -unittest'. This is what I get for the
 output:

 t=0.75, a=0.00, b=2.00, s1=-0.50, s2=0.00, rt1=-0.50, rt2=1.50 :::
 1.5
This: (with float) writefln("t=%.2f, a=%.2f, b=%.2f, s1=%.2f, s2=%.2f, rt1=%.2f, rt2=%.2f :::", t, a, b, s1, s2, rt1, rt2); writefln("t=%.2f, a=%f, b=%.2f, s1=%.2f, s2=%.2f, rt1=%.2f, rt2=%.2f :::", t, a, b, s1, s2, rt1, rt2); Outputs: (with float) t=0.75, a=0.00, b=2.00, s1=-0.50, s2=0.00, rt1=-0.50, rt2=1.50 ::: t=0.75, a=-2.000000, b=2.00, s1=-0.50, s2=0.00, rt1=-0.50, rt2=1.50 ::: difference: %.2f ---> %f
 I have no idea why 'a' is zero. 'rt1' and 'rt2' do not have the same
 value, and 'lerp' does not return 1.0. Compiling with 'dmd -inline
 -unittest' does produce the correct result as before, though.

 You can play with different compiler options, such as -O, to get the
 same weird behavior.

 I presume this is another DMD bug?
Jan 24 2012
parent reply sclytrack <sclytrack fake.com> writes:
---------------------------------------
alias float Real;
Real lerp(Real t, Real a, Real b)
{		
   Real s2 = t * b;
   writeln("t*b= ", s2);
   writeln("t*b= ", t * b);
   return s2;
}

Output:
t*b= 1.5
t*b= 1.5
-------------------------------------


alias float Real;

Real lerp(Real t, Real a, Real b)
{

   Real s1 = (1.0 - t) * a;

   Real s2 = t * b;
   writeln("t*b= ", s2);
   writeln("t*b= ", t * b);
   return s2;
}


Output:
t*b= 0
t*b= 1.5
-------------------------------------




 I presume this is another DMD bug?
yes.
Jan 24 2012
next sibling parent reply "Dejan Lekic" <dejan.lekic gmail.com> writes:
No, it is not a bug.

Here is a hint:

import std.stdio;

int main() {
  float f;
  writeln(f);
  return 0;
}

/+--- output ----------+
nan
+--- end of output ---+/
Jan 24 2012
next sibling parent reply sclytrack <sclytrack fake.com> writes:
On 01/24/2012 01:51 PM, Dejan Lekic wrote:
 No, it is not a bug.

 Here is a hint:

 import std.stdio;

 int main() {
 float f;
 writeln(f);
 return 0;
 }

 /+--- output ----------+
 nan
 +--- end of output ---+/
I don't understand.
Jan 24 2012
parent sclytrack <sclytrack fake.com> writes:
On 01/24/2012 04:41 PM, sclytrack wrote:
 On 01/24/2012 01:51 PM, Dejan Lekic wrote:
 No, it is not a bug.

 Here is a hint:

 import std.stdio;

 int main() {
 float f;
 writeln(f);
 return 0;
 }

 /+--- output ----------+
 nan
 +--- end of output ---+/
I don't understand.
I see now I forgot the input values. Sorry my IQ is 87. void calculate2(float a, float b) { float s1 = 1.0 - a; float s2 = a * b; writeln(s2); writeln(a * b); } -------INPUT values int main() { calculate2(0.75f,2.0f); return 0; } ---------------- Output: t*b= 0 t*b= 1.5 ----------------
Jan 24 2012
prev sibling parent Caligo <iteronvexor gmail.com> writes:
On Tue, Jan 24, 2012 at 6:51 AM, Dejan Lekic <dejan.lekic gmail.com> wrote:
 No, it is not a bug.

 Here is a hint:

 import std.stdio;

 int main() {
 =A0float f;
 =A0writeln(f);
 =A0return 0;
 }

 /+--- output ----------+
 nan
 +--- end of output ---+/
wow, what a great hint. sorry, but I'm not convinced that it's not a bug.
Jan 24 2012
prev sibling parent reply sclytrack <sclytrack fake.com> writes:
void calculate2(float a, float b)
{
	float s1 = 1.0 - a;
	float s2 = a * b;
	writeln(s2);
	writeln(a * b);
}

----------------
Output:
t*b= 0
t*b= 1.5
----------------


	assume	CS:.text._D4main10calculate2FffZv
_D4main10calculate2FffZv:
		push	RBP
		mov	RBP,RSP
		sub	RSP,020h
		movss	-010h[RBP],XMM0
		movss	-8[RBP],XMM1
		mov	RAX,03FF0000000000000h
		mov	-020h[RBP],RAX
		movsd	XMM2,-020h[RBP]
		cvtss2sd	XMM1,XMM1
		subsd	XMM2,XMM1
------conversion but xmm2 is no longer used
		cvtsd2ss	XMM2,XMM2
------precision error multiplication
		mulss	XMM1,XMM0
		movss	-018h[RBP],XMM1
		movss	XMM0,-018h[RBP]
		call	  _D3std5stdio14__T7writelnTfZ7writelnFfZv PC32
		movss	XMM0,-8[RBP]
		movss	XMM1,-010h[RBP]
		mulss	XMM0,XMM1
		call	  _D3std5stdio14__T7writelnTfZ7writelnFfZv PC32
		leave
		ret
		nop
		nop
		nop

------------
DMD64 D Compiler v2.057
Ubuntu 11.10
Jan 24 2012
parent reply dennis luehring <dl.soluz gmx.net> writes:
can you give us a complete out-of-the-box compileable example (with 
imports,main,etc.) with both examples the working/and nonworking

does it work correct with dmd(32bit)?

is this "calculate2" needed to reproduce the behavior?

and what compiler did you test: dmd64, (dmd32?), ...?

Am 24.01.2012 16:20, schrieb sclytrack:
 void calculate2(float a, float b)
 {
 	float s1 = 1.0 - a;
 	float s2 = a * b;
 	writeln(s2);
 	writeln(a * b);
 }

 ----------------
 Output:
 t*b= 0
 t*b= 1.5
 ----------------


 	assume	CS:.text._D4main10calculate2FffZv
 _D4main10calculate2FffZv:
 		push	RBP
 		mov	RBP,RSP
 		sub	RSP,020h
 		movss	-010h[RBP],XMM0
 		movss	-8[RBP],XMM1
 		mov	RAX,03FF0000000000000h
 		mov	-020h[RBP],RAX
 		movsd	XMM2,-020h[RBP]
 		cvtss2sd	XMM1,XMM1
 		subsd	XMM2,XMM1
 ------conversion but xmm2 is no longer used
 		cvtsd2ss	XMM2,XMM2
 ------precision error multiplication
 		mulss	XMM1,XMM0
 		movss	-018h[RBP],XMM1
 		movss	XMM0,-018h[RBP]
 		call	  _D3std5stdio14__T7writelnTfZ7writelnFfZv PC32
 		movss	XMM0,-8[RBP]
 		movss	XMM1,-010h[RBP]
 		mulss	XMM0,XMM1
 		call	  _D3std5stdio14__T7writelnTfZ7writelnFfZv PC32
 		leave
 		ret
 		nop
 		nop
 		nop

 ------------
 DMD64 D Compiler v2.057
 Ubuntu 11.10
Jan 24 2012
next sibling parent dennis luehring <dl.soluz gmx.net> writes:
double works correct under dmd64, but float not?

what is the behavior of dmd32 in this szenario?
Jan 24 2012
prev sibling parent reply sclytrack <sclytrack fake.com> writes:
Yes, I missed my lessons in clear communication.


-------------------------------------------------
+	The complete source files.
-------------------------------------------------

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

-------------------------------------------------
+	Compiler
-------------------------------------------------

DMD64 D Compiler v2.057
Copyright (c) 1999-2011 by Digital Mars written by Walter Bright
Documentation: http://www.digitalmars.com/d/2.0/index.html
Usage:

This is from the downloaded zip file.
I'm using eclipse to compile it. Added the -debug.


-------------------------------------------------
+	Ubuntu 11.10 64 bit
-------------------------------------------------

uname -r
3.0.0-15-generic

-------------------------------------------------
+	BEHAVIOUR
-------------------------------------------------

As for the behaviour on 32 bit. I wish
somebody else would do it. :-)

In the previous message here below is the assembly
output of calculate2. Pay close attention to the
cvtss2sd, the cvtsd2ss and the mulss.

	float s1 = 1.0 - a;
	float s2 = a * b;

It converts the float a to double precision.
then performs the s1 calculation.

Then does the s2 calculation with the high
precision a and the normal float b.

Also it performs the "cvtsd2ss %xmm2,%xmm2"
for no reason at all. As it is no longer used
in the rest the code.

-------------------------------------------------
+	objdump -S test1.o
-------------------------------------------------

0000000000000000 <_D4main10calculate2FffZv>:
    0:	55                   	push   %rbp
    1:	48 8b ec             	mov    %rsp,%rbp
    4:	48 83 ec 20          	sub    $0x20,%rsp
    8:	f3 0f 11 45 f0       	movss  %xmm0,-0x10(%rbp)
    d:	f3 0f 11 4d f8       	movss  %xmm1,-0x8(%rbp)
   12:	48 b8 00 00 00 00 00 	movabs $0x3ff0000000000000,%rax
   19:	00 f0 3f
   1c:	48 89 45 e0          	mov    %rax,-0x20(%rbp)
   20:	f2 0f 10 55 e0       	movsd  -0x20(%rbp),%xmm2
   25:	f3 0f 5a c9          	cvtss2sd %xmm1,%xmm1
   29:	f2 0f 5c d1          	subsd  %xmm1,%xmm2
   2d:	f2 0f 5a d2          	cvtsd2ss %xmm2,%xmm2
   31:	f3 0f 59 c8          	mulss  %xmm0,%xmm1
   35:	f3 0f 11 4d e8       	movss  %xmm1,-0x18(%rbp)
   3a:	f3 0f 10 45 e8       	movss  -0x18(%rbp),%xmm0
   3f:	e8 00 00 00 00       	callq  44 <_D4main10calculate2FffZv+0x44>
   44:	f3 0f 10 45 f8       	movss  -0x8(%rbp),%xmm0
   49:	f3 0f 10 4d f0       	movss  -0x10(%rbp),%xmm1
   4e:	f3 0f 59 c1          	mulss  %xmm1,%xmm0
   52:	e8 00 00 00 00       	callq  57 <_D4main10calculate2FffZv+0x57>
   57:	c9                   	leaveq
   58:	c3                   	retq
   59:	90                   	nop
   5a:	90                   	nop
   5b:	90                   	nop


I'm going to eat now.



On 01/24/2012 05:01 PM, dennis luehring wrote:
 can you give us a complete out-of-the-box compileable example (with
 imports,main,etc.) with both examples the working/and nonworking

 does it work correct with dmd(32bit)?

 is this "calculate2" needed to reproduce the behavior?

 and what compiler did you test: dmd64, (dmd32?), ...?

 Am 24.01.2012 16:20, schrieb sclytrack:
 void calculate2(float a, float b)
 {
 float s1 = 1.0 - a;
 float s2 = a * b;
 writeln(s2);
 writeln(a * b);
 }

 ----------------
 Output:
 t*b= 0
 t*b= 1.5
 ----------------


 assume CS:.text._D4main10calculate2FffZv
 _D4main10calculate2FffZv:
 push RBP
 mov RBP,RSP
 sub RSP,020h
 movss -010h[RBP],XMM0
 movss -8[RBP],XMM1
 mov RAX,03FF0000000000000h
 mov -020h[RBP],RAX
 movsd XMM2,-020h[RBP]
 cvtss2sd XMM1,XMM1
 subsd XMM2,XMM1
 ------conversion but xmm2 is no longer used
 cvtsd2ss XMM2,XMM2
 ------precision error multiplication
 mulss XMM1,XMM0
 movss -018h[RBP],XMM1
 movss XMM0,-018h[RBP]
 call _D3std5stdio14__T7writelnTfZ7writelnFfZv PC32
 movss XMM0,-8[RBP]
 movss XMM1,-010h[RBP]
 mulss XMM0,XMM1
 call _D3std5stdio14__T7writelnTfZ7writelnFfZv PC32
 leave
 ret
 nop
 nop
 nop

 ------------
 DMD64 D Compiler v2.057
 Ubuntu 11.10
Jan 24 2012
parent reply dennis luehring <dl.soluz gmx.net> writes:
Am 24.01.2012 18:49, schrieb sclytrack:

dmd 2.057 give this result under windows/32bit

calculate1:
1.5
1.5
calculate2:
1.5
1.5
calculate3:
1.5
1.5

so its seems to be an x64 compiler bug

 Yes, I missed my lessons in clear communication.


 -------------------------------------------------
 +	The complete source files.
 -------------------------------------------------

 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

 -------------------------------------------------
 +	Compiler
 -------------------------------------------------

 DMD64 D Compiler v2.057
 Copyright (c) 1999-2011 by Digital Mars written by Walter Bright
 Documentation: http://www.digitalmars.com/d/2.0/index.html
 Usage:

 This is from the downloaded zip file.
 I'm using eclipse to compile it. Added the -debug.


 -------------------------------------------------
 +	Ubuntu 11.10 64 bit
 -------------------------------------------------

 uname -r
 3.0.0-15-generic

 -------------------------------------------------
 +	BEHAVIOUR
 -------------------------------------------------

 As for the behaviour on 32 bit. I wish
 somebody else would do it. :-)

 In the previous message here below is the assembly
 output of calculate2. Pay close attention to the
 cvtss2sd, the cvtsd2ss and the mulss.

 	float s1 = 1.0 - a;
 	float s2 = a * b;

 It converts the float a to double precision.
 then performs the s1 calculation.

 Then does the s2 calculation with the high
 precision a and the normal float b.

 Also it performs the "cvtsd2ss %xmm2,%xmm2"
 for no reason at all. As it is no longer used
 in the rest the code.

 -------------------------------------------------
 +	objdump -S test1.o
 -------------------------------------------------

 0000000000000000<_D4main10calculate2FffZv>:
      0:	55                   	push   %rbp
      1:	48 8b ec             	mov    %rsp,%rbp
      4:	48 83 ec 20          	sub    $0x20,%rsp
      8:	f3 0f 11 45 f0       	movss  %xmm0,-0x10(%rbp)
      d:	f3 0f 11 4d f8       	movss  %xmm1,-0x8(%rbp)
     12:	48 b8 00 00 00 00 00 	movabs $0x3ff0000000000000,%rax
     19:	00 f0 3f
     1c:	48 89 45 e0          	mov    %rax,-0x20(%rbp)
     20:	f2 0f 10 55 e0       	movsd  -0x20(%rbp),%xmm2
     25:	f3 0f 5a c9          	cvtss2sd %xmm1,%xmm1
     29:	f2 0f 5c d1          	subsd  %xmm1,%xmm2
     2d:	f2 0f 5a d2          	cvtsd2ss %xmm2,%xmm2
     31:	f3 0f 59 c8          	mulss  %xmm0,%xmm1
     35:	f3 0f 11 4d e8       	movss  %xmm1,-0x18(%rbp)
     3a:	f3 0f 10 45 e8       	movss  -0x18(%rbp),%xmm0
     3f:	e8 00 00 00 00       	callq  44<_D4main10calculate2FffZv+0x44>
     44:	f3 0f 10 45 f8       	movss  -0x8(%rbp),%xmm0
     49:	f3 0f 10 4d f0       	movss  -0x10(%rbp),%xmm1
     4e:	f3 0f 59 c1          	mulss  %xmm1,%xmm0
     52:	e8 00 00 00 00       	callq  57<_D4main10calculate2FffZv+0x57>
     57:	c9                   	leaveq
     58:	c3                   	retq
     59:	90                   	nop
     5a:	90                   	nop
     5b:	90                   	nop


 I'm going to eat now.



 On 01/24/2012 05:01 PM, dennis luehring wrote:
  can you give us a complete out-of-the-box compileable example (with
  imports,main,etc.) with both examples the working/and nonworking

  does it work correct with dmd(32bit)?

  is this "calculate2" needed to reproduce the behavior?

  and what compiler did you test: dmd64, (dmd32?), ...?

  Am 24.01.2012 16:20, schrieb sclytrack:
  void calculate2(float a, float b)
  {
  float s1 = 1.0 - a;
  float s2 = a * b;
  writeln(s2);
  writeln(a * b);
  }

  ----------------
  Output:
  t*b= 0
  t*b= 1.5
  ----------------


  assume CS:.text._D4main10calculate2FffZv
  _D4main10calculate2FffZv:
  push RBP
  mov RBP,RSP
  sub RSP,020h
  movss -010h[RBP],XMM0
  movss -8[RBP],XMM1
  mov RAX,03FF0000000000000h
  mov -020h[RBP],RAX
  movsd XMM2,-020h[RBP]
  cvtss2sd XMM1,XMM1
  subsd XMM2,XMM1
  ------conversion but xmm2 is no longer used
  cvtsd2ss XMM2,XMM2
  ------precision error multiplication
  mulss XMM1,XMM0
  movss -018h[RBP],XMM1
  movss XMM0,-018h[RBP]
  call _D3std5stdio14__T7writelnTfZ7writelnFfZv PC32
  movss XMM0,-8[RBP]
  movss XMM1,-010h[RBP]
  mulss XMM0,XMM1
  call _D3std5stdio14__T7writelnTfZ7writelnFfZv PC32
  leave
  ret
  nop
  nop
  nop

  ------------
  DMD64 D Compiler v2.057
  Ubuntu 11.10
Jan 24 2012
parent reply Caligo <iteronvexor gmail.com> writes:
How did you compile it?  As in my original post, it matters how you
compile it.  In this case (I'm on a 64-bit GNU/Linux system),
compiling with '-inline' doesn't trigger the bug.
Jan 24 2012
parent reply dennis luehring <dl.soluz gmx.net> writes:
Am 24.01.2012 19:13, schrieb Caligo:
 How did you compile it?  As in my original post, it matters how you
 compile it.  In this case (I'm on a 64-bit GNU/Linux system),
 compiling with '-inline' doesn't trigger the bug.
im on win7 (64bit) - but the windows dmd2.057 isn't able to produce x64 code (is that correct?) it works with "dmd -inline floattest.d" and "dmd -debug floattest.d"
Jan 24 2012
parent reply %u <test test.com> writes:
Shouldn't this go into 'digitalmars.D' ?
Jan 24 2012
parent reply Timon Gehr <timon.gehr gmx.ch> writes:
On 01/24/2012 10:28 PM, %u wrote:
 Shouldn't this go into 'digitalmars.D' ?
It should go straight to the bug tracker.
Jan 24 2012
parent reply sclytrack <sclytrack fake.com> writes:
On 01/25/2012 01:12 AM, Timon Gehr wrote:
 On 01/24/2012 10:28 PM, %u wrote:
 Shouldn't this go into 'digitalmars.D' ?
It should go straight to the bug tracker.
Issue 7391 - floating wtf dmd 2.057 64
Jan 28 2012
next sibling parent Timon Gehr <timon.gehr gmx.ch> writes:
On 01/28/2012 04:56 PM, sclytrack wrote:
 On 01/25/2012 01:12 AM, Timon Gehr wrote:
 On 01/24/2012 10:28 PM, %u wrote:
 Shouldn't this go into 'digitalmars.D' ?
It should go straight to the bug tracker.
Issue 7391 - floating wtf dmd 2.057 64
Thanks!
Jan 28 2012
prev sibling parent reply Caligo <iteronvexor gmail.com> writes:
I've already reported, and it's been fixed in the latest:

http://d.puremagic.com/issues/show_bug.cgi?id=7376


On Sat, Jan 28, 2012 at 9:56 AM, sclytrack <sclytrack fake.com> wrote:
 On 01/25/2012 01:12 AM, Timon Gehr wrote:
 On 01/24/2012 10:28 PM, %u wrote:
 Shouldn't this go into 'digitalmars.D' ?
It should go straight to the bug tracker.
Issue 7391 - floating wtf dmd 2.057 64
Jan 28 2012
parent reply sclytrack <sclytrack hotmail.com> writes:
Now I've waisted Walter's precious time.
I feel so sad now :-(



On 01/28/2012 07:49 PM, Caligo wrote:
 I've already reported, and it's been fixed in the latest:

 http://d.puremagic.com/issues/show_bug.cgi?id=7376


 On Sat, Jan 28, 2012 at 9:56 AM, sclytrack<sclytrack fake.com>  wrote:
 On 01/25/2012 01:12 AM, Timon Gehr wrote:
 On 01/24/2012 10:28 PM, %u wrote:
 Shouldn't this go into 'digitalmars.D' ?
It should go straight to the bug tracker.
Issue 7391 - floating wtf dmd 2.057 64
Jan 28 2012
parent reply Caligo <iteronvexor gmail.com> writes:
On Sat, Jan 28, 2012 at 2:04 PM, sclytrack <sclytrack hotmail.com> wrote:
 Now I've waisted Walter's precious time.
 I feel so sad now :-(
I should have made a post about the fact that I had already bug reported it, but I forgot. Sorry.
Jan 28 2012
parent reply sclytrack <sclytrack hotmail.com> writes:
Prior to filing the bug I tried to compile dmd from source.
I have now succeeded. The only problem I had was a missing
symbolic link libstdc++.so and this in Ubuntu 11.10. So
I just created it.

/usr/lib32/libstdc++.so -> /usr/lib/i386-linux-gnu/libstdc++.so.6

Then "make -f posix" and in the dmd/src directory.
The bug is indeed gone. It uses the xmm3 register now to store
the intermediate value.

Going to clone phobos now. While I'm at it. :-)



 On 01/29/2012 06:05 AM, Caligo wrote:
Jan 28 2012
parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Sunday, January 29, 2012 08:43:54 sclytrack wrote:
 Prior to filing the bug I tried to compile dmd from source.
 I have now succeeded. The only problem I had was a missing
 symbolic link libstdc++.so and this in Ubuntu 11.10. So
 I just created it.
 
 /usr/lib32/libstdc++.so -> /usr/lib/i386-linux-gnu/libstdc++.so.6
 
 Then "make -f posix" and in the dmd/src directory.
 The bug is indeed gone. It uses the xmm3 register now to store
 the intermediate value.
 
 Going to clone phobos now. While I'm at it. :-)
Don't forget druntime. You need it as well if you want to build Phobos. - Jonathan M Davis
Jan 29 2012