\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}double f(double a, double b, double c, double d) {
double r62590 = b;
double r62591 = c;
double r62592 = r62590 * r62591;
double r62593 = a;
double r62594 = d;
double r62595 = r62593 * r62594;
double r62596 = r62592 - r62595;
double r62597 = r62591 * r62591;
double r62598 = r62594 * r62594;
double r62599 = r62597 + r62598;
double r62600 = r62596 / r62599;
return r62600;
}
double f(double a, double b, double c, double d) {
double r62601 = b;
double r62602 = c;
double r62603 = r62601 * r62602;
double r62604 = a;
double r62605 = d;
double r62606 = r62604 * r62605;
double r62607 = r62603 - r62606;
double r62608 = r62602 * r62602;
double r62609 = r62605 * r62605;
double r62610 = r62608 + r62609;
double r62611 = r62607 / r62610;
return r62611;
}




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus d
Results
| Original | 26.5 |
|---|---|
| Target | 0.4 |
| Herbie | 26.5 |
Initial program 26.5
rmApplied add-sqr-sqrt26.5
Applied associate-/r*26.4
Final simplification26.5
herbie shell --seed 2019297
(FPCore (a b c d)
:name "Complex division, imag part"
:precision binary64
:herbie-target
(if (< (fabs d) (fabs c)) (/ (- b (* a (/ d c))) (+ c (* d (/ d c)))) (/ (+ (- a) (* b (/ c d))) (+ d (* c (/ c d)))))
(/ (- (* b c) (* a d)) (+ (* c c) (* d d))))