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



--- Comment #3 from Witold Baryluk <bary...@smp.if.uj.edu.pl> 2010-01-29 
04:28:20 PST ---
(In reply to comment #2)
> is this maybe related to issue 3736 ?

I don't know. This is quite different issues (i'm not using structs, and i
doesn't call functions when error occure).
My bug have probably something with FPU register allocation, but this is just a
guess.

I further reduced test case, change "write("%s",half)" to nic(), where nic is
empty function, and write code directly in main



import std.math;
import std.stdio;

void nic() {}

void main() {
foreach (i; 1 .. 10) {
    auto z = 0.1 + 0.001*i;
    double left = -7.0, right = 7.0, half;
    while (true) {
        half = (left+right)*0.5; // or left+0.5*(right-left);
version(something) {
        nic(); // adding this solves problem
}

        if (left == half) {
            break; // or break
        }
        if (half == right) {
            break; // or break
        }
/+
        // the same effect
        if ((left == half) || (half == right)) {
            return half; // or break
        }
+/
        double fhalf = 1.0/(half*half) * (half + 0.7) - z;
        if (fhalf > 0.0) {
            right = half;
        } else if (fhalf <= 0.0) {
            left = half;
        }
    };

    writefln("%g %g", z, half);
}
}



One of the dide by side diff (left -O, right -O + nic):
http://pastebin.com/f17a77299

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to