\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 r74969 = b;
double r74970 = c;
double r74971 = r74969 * r74970;
double r74972 = a;
double r74973 = d;
double r74974 = r74972 * r74973;
double r74975 = r74971 - r74974;
double r74976 = r74970 * r74970;
double r74977 = r74973 * r74973;
double r74978 = r74976 + r74977;
double r74979 = r74975 / r74978;
return r74979;
}
double f(double a, double b, double c, double d) {
double r74980 = b;
double r74981 = c;
double r74982 = r74980 * r74981;
double r74983 = a;
double r74984 = d;
double r74985 = r74983 * r74984;
double r74986 = r74982 - r74985;
double r74987 = r74981 * r74981;
double r74988 = r74984 * r74984;
double r74989 = r74987 + r74988;
double r74990 = r74986 / r74989;
return r74990;
}




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus d
Results
| Original | 26.1 |
|---|---|
| Target | 0.4 |
| Herbie | 26.1 |
Initial program 26.1
rmApplied add-sqr-sqrt26.1
Applied associate-/r*26.0
Final simplification26.1
herbie shell --seed 2019291
(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))))