Average Error: 25.5 → 0.5
Time: 49.8s
Precision: 64
Internal Precision: 576
\[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
\[\frac{x.re \cdot \frac{-y.im}{\sqrt{y.re^2 + y.im^2}^*} + x.im \cdot \left(\frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot y.re\right)}{\sqrt{y.re^2 + y.im^2}^*}\]

Error

Bits error versus x.re

Bits error versus x.im

Bits error versus y.re

Bits error versus y.im

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 25.5

    \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
  2. Using strategy rm
  3. Applied add-sqr-sqrt25.5

    \[\leadsto \frac{x.im \cdot y.re - x.re \cdot y.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\]
  4. Applied *-un-lft-identity25.5

    \[\leadsto \frac{\color{blue}{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
  5. Applied times-frac25.5

    \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\]
  6. Simplified25.5

    \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re^2 + y.im^2}^*}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
  7. Simplified16.6

    \[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \color{blue}{\frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re^2 + y.im^2}^*}}\]
  8. Using strategy rm
  9. Applied associate-*r/16.5

    \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\sqrt{y.re^2 + y.im^2}^*}}\]
  10. Using strategy rm
  11. Applied sub-neg16.5

    \[\leadsto \frac{\frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \color{blue}{\left(x.im \cdot y.re + \left(-x.re \cdot y.im\right)\right)}}{\sqrt{y.re^2 + y.im^2}^*}\]
  12. Applied distribute-rgt-in16.5

    \[\leadsto \frac{\color{blue}{\left(x.im \cdot y.re\right) \cdot \frac{1}{\sqrt{y.re^2 + y.im^2}^*} + \left(-x.re \cdot y.im\right) \cdot \frac{1}{\sqrt{y.re^2 + y.im^2}^*}}}{\sqrt{y.re^2 + y.im^2}^*}\]
  13. Simplified9.0

    \[\leadsto \frac{\left(x.im \cdot y.re\right) \cdot \frac{1}{\sqrt{y.re^2 + y.im^2}^*} + \color{blue}{\left(-x.re\right) \cdot \frac{y.im}{\sqrt{y.re^2 + y.im^2}^*}}}{\sqrt{y.re^2 + y.im^2}^*}\]
  14. Using strategy rm
  15. Applied associate-*l*0.5

    \[\leadsto \frac{\color{blue}{x.im \cdot \left(y.re \cdot \frac{1}{\sqrt{y.re^2 + y.im^2}^*}\right)} + \left(-x.re\right) \cdot \frac{y.im}{\sqrt{y.re^2 + y.im^2}^*}}{\sqrt{y.re^2 + y.im^2}^*}\]
  16. Final simplification0.5

    \[\leadsto \frac{x.re \cdot \frac{-y.im}{\sqrt{y.re^2 + y.im^2}^*} + x.im \cdot \left(\frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot y.re\right)}{\sqrt{y.re^2 + y.im^2}^*}\]

Runtime

Time bar (total: 49.8s)Debug logProfile

herbie shell --seed 2018216 +o rules:numerics
(FPCore (x.re x.im y.re y.im)
  :name "_divideComplex, imaginary part"
  (/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))