www.digitalmars.com         C & C++   DMDScript  

c++ - Optimization bug

reply 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
parent 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