\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}\frac{c \cdot b - a \cdot d}{c \cdot c + d \cdot d}double f(double a, double b, double c, double d) {
double r44066413 = b;
double r44066414 = c;
double r44066415 = r44066413 * r44066414;
double r44066416 = a;
double r44066417 = d;
double r44066418 = r44066416 * r44066417;
double r44066419 = r44066415 - r44066418;
double r44066420 = r44066414 * r44066414;
double r44066421 = r44066417 * r44066417;
double r44066422 = r44066420 + r44066421;
double r44066423 = r44066419 / r44066422;
return r44066423;
}
double f(double a, double b, double c, double d) {
double r44066424 = c;
double r44066425 = b;
double r44066426 = r44066424 * r44066425;
double r44066427 = a;
double r44066428 = d;
double r44066429 = r44066427 * r44066428;
double r44066430 = r44066426 - r44066429;
double r44066431 = r44066424 * r44066424;
double r44066432 = r44066428 * r44066428;
double r44066433 = r44066431 + r44066432;
double r44066434 = r44066430 / r44066433;
return r44066434;
}




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus d
Results
| Original | 26.5 |
|---|---|
| Target | 0.5 |
| Herbie | 26.5 |
Initial program 26.5
rmApplied clear-num26.7
rmApplied *-un-lft-identity26.7
Applied *-un-lft-identity26.7
Applied times-frac26.7
Simplified26.7
Simplified26.5
Final simplification26.5
herbie shell --seed 2019120
(FPCore (a b c d)
:name "Complex division, imag part"
: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))))