\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}\frac{\frac{b}{\left|e^{\log \left(\sqrt[3]{c \cdot c + d \cdot d}\right)}\right|} \cdot \frac{c}{\sqrt{\sqrt[3]{c \cdot c + d \cdot d}}} - \frac{a \cdot d}{\sqrt{c \cdot c + d \cdot d}}}{\sqrt{c \cdot c + d \cdot d}}double f(double a, double b, double c, double d) {
double r112657 = b;
double r112658 = c;
double r112659 = r112657 * r112658;
double r112660 = a;
double r112661 = d;
double r112662 = r112660 * r112661;
double r112663 = r112659 - r112662;
double r112664 = r112658 * r112658;
double r112665 = r112661 * r112661;
double r112666 = r112664 + r112665;
double r112667 = r112663 / r112666;
return r112667;
}
double f(double a, double b, double c, double d) {
double r112668 = b;
double r112669 = c;
double r112670 = r112669 * r112669;
double r112671 = d;
double r112672 = r112671 * r112671;
double r112673 = r112670 + r112672;
double r112674 = cbrt(r112673);
double r112675 = log(r112674);
double r112676 = exp(r112675);
double r112677 = fabs(r112676);
double r112678 = r112668 / r112677;
double r112679 = sqrt(r112674);
double r112680 = r112669 / r112679;
double r112681 = r112678 * r112680;
double r112682 = a;
double r112683 = r112682 * r112671;
double r112684 = sqrt(r112673);
double r112685 = r112683 / r112684;
double r112686 = r112681 - r112685;
double r112687 = r112686 / r112684;
return r112687;
}




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus d
Results
| Original | 26.1 |
|---|---|
| Target | 0.5 |
| Herbie | 25.3 |
Initial program 26.1
rmApplied add-sqr-sqrt26.1
Applied associate-/r*26.0
rmApplied div-sub26.0
rmApplied add-cube-cbrt26.2
Applied sqrt-prod26.2
Applied times-frac24.5
Simplified24.5
rmApplied add-exp-log25.3
Final simplification25.3
herbie shell --seed 2019354
(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))))