Average Error: 26.0 → 16.8
Time: 1.0m
Precision: 64
Internal Precision: 128
\[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
\[\frac{\frac{1}{\sqrt{y.im^2 + y.re^2}^*}}{\frac{\sqrt{y.im^2 + y.re^2}^*}{x.im \cdot y.re - x.re \cdot y.im}}\]

Error

Bits error versus x.re

Bits error versus x.im

Bits error versus y.re

Bits error versus y.im

Derivation

  1. Initial program 26.0

    \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
  2. Simplified26.0

    \[\leadsto \color{blue}{\frac{x.im \cdot y.re - x.re \cdot y.im}{(y.im \cdot y.im + \left(y.re \cdot y.re\right))_*}}\]
  3. Using strategy rm
  4. Applied clear-num26.1

    \[\leadsto \color{blue}{\frac{1}{\frac{(y.im \cdot y.im + \left(y.re \cdot y.re\right))_*}{x.im \cdot y.re - x.re \cdot y.im}}}\]
  5. Using strategy rm
  6. Applied *-un-lft-identity26.1

    \[\leadsto \frac{1}{\frac{(y.im \cdot y.im + \left(y.re \cdot y.re\right))_*}{\color{blue}{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}}}\]
  7. Applied add-sqr-sqrt26.1

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

    \[\leadsto \frac{1}{\color{blue}{\frac{\sqrt{(y.im \cdot y.im + \left(y.re \cdot y.re\right))_*}}{1} \cdot \frac{\sqrt{(y.im \cdot y.im + \left(y.re \cdot y.re\right))_*}}{x.im \cdot y.re - x.re \cdot y.im}}}\]
  9. Applied associate-/r*26.0

    \[\leadsto \color{blue}{\frac{\frac{1}{\frac{\sqrt{(y.im \cdot y.im + \left(y.re \cdot y.re\right))_*}}{1}}}{\frac{\sqrt{(y.im \cdot y.im + \left(y.re \cdot y.re\right))_*}}{x.im \cdot y.re - x.re \cdot y.im}}}\]
  10. Using strategy rm
  11. Applied fma-udef26.0

    \[\leadsto \frac{\frac{1}{\frac{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}}{1}}}{\frac{\sqrt{(y.im \cdot y.im + \left(y.re \cdot y.re\right))_*}}{x.im \cdot y.re - x.re \cdot y.im}}\]
  12. Applied hypot-def26.0

    \[\leadsto \frac{\frac{1}{\frac{\color{blue}{\sqrt{y.im^2 + y.re^2}^*}}{1}}}{\frac{\sqrt{(y.im \cdot y.im + \left(y.re \cdot y.re\right))_*}}{x.im \cdot y.re - x.re \cdot y.im}}\]
  13. Using strategy rm
  14. Applied fma-udef26.0

    \[\leadsto \frac{\frac{1}{\frac{\sqrt{y.im^2 + y.re^2}^*}{1}}}{\frac{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}}{x.im \cdot y.re - x.re \cdot y.im}}\]
  15. Applied hypot-def16.8

    \[\leadsto \frac{\frac{1}{\frac{\sqrt{y.im^2 + y.re^2}^*}{1}}}{\frac{\color{blue}{\sqrt{y.im^2 + y.re^2}^*}}{x.im \cdot y.re - x.re \cdot y.im}}\]
  16. Final simplification16.8

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

Reproduce

herbie shell --seed 2019093 +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))))