Average Error: 27.0 → 23.7
Time: 3.5s
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) (b * ((double) (c / ((double) (((double) (c * c)) + ((double) (d * d)))))))) - ((double) (((double) (a / ((double) sqrt(((double) (((double) (c * c)) + ((double) (d * d)))))))) * ((double) (d / ((double) sqrt(((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

Original27.0
Target0.5
Herbie23.7
\[\]

Derivation

  1. Initial program 27.0

    \[\]
  2. Using strategy rm
  3. Applied div-sub27.0

    \[\leadsto \]
  4. Simplified25.5

    \[\leadsto \]
  5. Simplified23.6

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

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

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

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

    \[\leadsto \]
  11. Simplified23.7

    \[\leadsto \]
  12. Final simplification23.7

    \[\leadsto \]

Reproduce

herbie shell --seed 2020181 
(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))))