\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}\frac{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \left(\frac{b}{\frac{\mathsf{hypot}\left(c, d\right)}{c}} - \frac{a}{\frac{\mathsf{hypot}\left(c, d\right)}{d}}\right)}{\frac{\frac{\mathsf{hypot}\left(c, d\right)}{1}}{\sqrt[3]{1}}}double code(double a, double b, double c, double d) {
return ((double) (((double) (((double) (b * c)) - ((double) (a * d)))) / ((double) (((double) (c * c)) + ((double) (d * d))))));
}
double code(double a, double b, double c, double d) {
return ((double) (((double) (((double) (((double) cbrt(1.0)) * ((double) cbrt(1.0)))) * ((double) (((double) (b / ((double) (((double) hypot(c, d)) / c)))) - ((double) (a / ((double) (((double) hypot(c, d)) / d)))))))) / ((double) (((double) (((double) hypot(c, d)) / 1.0)) / ((double) cbrt(1.0))))));
}




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus d
Results
| Original | 26.1 |
|---|---|
| Target | 0.3 |
| Herbie | 0.4 |
Initial program 26.1
rmApplied add-sqr-sqrt26.1
Applied *-un-lft-identity26.1
Applied times-frac26.1
Simplified26.1
Simplified16.7
rmApplied div-sub16.7
Simplified9.2
Simplified0.6
rmApplied add-cube-cbrt0.6
Applied associate-/l*0.6
Applied associate-*l/0.4
Final simplification0.4
herbie shell --seed 2020113 +o rules:numerics
(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))))