\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.0 |
|---|---|
| Target | 0.5 |
| Herbie | 0.6 |
Initial program 26.0
rmApplied add-sqr-sqrt26.0
Applied *-un-lft-identity26.0
Applied times-frac26.0
Simplified26.0
Simplified16.9
rmApplied div-sub16.9
Simplified9.2
Simplified0.8
rmApplied add-cube-cbrt0.8
Applied associate-/l*0.8
Applied associate-*l/0.6
Final simplification0.6
herbie shell --seed 2020114 +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))))