Average Error: 25.9 → 24.8
Time: 3.9s
Precision: binary64
\[\]
\[\]
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) (c / ((double) sqrt(((double) (((double) (c * c)) + ((double) (d * d)))))))) * ((double) (b / ((double) sqrt(((double) (((double) (c * c)) + ((double) (d * d)))))))))) - ((double) (d * ((double) (a / ((double) (((double) (c * c)) + ((double) (d * d))))))))));
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original25.9
Target0.4
Herbie24.8
\[\]

Derivation

  1. Initial program 25.9

    \[\]
  2. Using strategy rm
  3. Applied div-sub25.9

    \[\leadsto \]
  4. Simplified26.7

    \[\leadsto \]
  5. Simplified26.6

    \[\leadsto \]
  6. Using strategy rm
  7. Applied add-sqr-sqrt26.6

    \[\leadsto \]
  8. Applied *-un-lft-identity26.6

    \[\leadsto \]
  9. Applied times-frac26.6

    \[\leadsto \]
  10. Applied associate-*r*24.8

    \[\leadsto \]
  11. Simplified24.8

    \[\leadsto \]
  12. Final simplification24.8

    \[\leadsto \]

Reproduce

herbie shell --seed 2020190 
(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)))) (/ (+ (neg a) (* b (/ c d))) (+ d (* c (/ c d)))))

  (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))