www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - Optimization bug

↑ ↓ ← Brian Gardner <briangr friberg.us> writes:
cbug2.c:
#include <complex.h>
#include <stdio.h>

int main(void){
unsigned int x = 7;
unsigned int y = 9;

long double complex z = x * 0.02l + (-2.0l) + I * (y * 0.02l + (-2.0l));

printf("%g + I * (%g)", (double) creall(z), (double) cimagl(z));
return 0;
}

dmc cbug2.c -o & cbug2
-2 + I * (-1.82)

dmc cbug2.c & cbug2
-1.86 + I * (-1.82)

This is the second bug (which I report) involving complex numbers that 
ruined my computations!

The first bug was reported on Feb. 3, 2006 in post titled "Complex type 
bug".

Do you plan to fix the complex arithmetic of DMC?

Brian
Dec 10 2006
↑ ↓ → Walter Bright <newshound digitalmars.com> writes:
Brian Gardner wrote:
 Do you plan to fix the complex arithmetic of DMC?

Yes, I've fixed several complex arithmetic bugs. Have you tried the latest beta?
Dec 11 2006