Average Error: 25.4 → 10.8
Time: 2.6m
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}\]
\[\begin{array}{l} \mathbf{if}\;y.re \le -1.182260775010774 \cdot 10^{+97}:\\ \;\;\;\;\frac{(\left(\frac{x.re}{y.re}\right) \cdot y.im + \left(-x.im\right))_*}{\sqrt{y.im^2 + y.re^2}^*}\\ \mathbf{elif}\;y.re \le 8.927282505690149 \cdot 10^{+75}:\\ \;\;\;\;\frac{\frac{y.re \cdot x.im - x.re \cdot y.im}{\sqrt{y.im^2 + y.re^2}^*}}{\sqrt{y.im^2 + y.re^2}^*}\\ \mathbf{else}:\\ \;\;\;\;\frac{(\left(\frac{x.re}{y.re}\right) \cdot \left(-y.im\right) + x.im)_*}{\sqrt{y.im^2 + y.re^2}^*}\\ \end{array}\]

Error

Bits error versus x.re

Bits error versus x.im

Bits error versus y.re

Bits error versus y.im

Derivation

  1. Split input into 3 regimes
  2. if y.re < -1.182260775010774e+97

    1. Initial program 38.7

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
    2. Applied simplify38.7

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

      \[\leadsto \frac{y.re \cdot x.im - x.re \cdot y.im}{\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))_*}}}\]
    5. Applied *-un-lft-identity38.7

      \[\leadsto \frac{\color{blue}{1 \cdot \left(y.re \cdot x.im - x.re \cdot y.im\right)}}{\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))_*}}\]
    6. Applied times-frac38.7

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

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

      \[\leadsto \frac{1}{\sqrt{y.im^2 + y.re^2}^*} \cdot \color{blue}{\frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.im^2 + y.re^2}^*}}\]
    9. Using strategy rm
    10. Applied add-sqr-sqrt25.1

      \[\leadsto \frac{1}{\sqrt{y.im^2 + y.re^2}^*} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\color{blue}{\sqrt{\sqrt{y.im^2 + y.re^2}^*} \cdot \sqrt{\sqrt{y.im^2 + y.re^2}^*}}}\]
    11. Applied associate-/r*25.1

      \[\leadsto \frac{1}{\sqrt{y.im^2 + y.re^2}^*} \cdot \color{blue}{\frac{\frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{\sqrt{y.im^2 + y.re^2}^*}}}{\sqrt{\sqrt{y.im^2 + y.re^2}^*}}}\]
    12. Taylor expanded around -inf 14.0

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

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

    if -1.182260775010774e+97 < y.re < 8.927282505690149e+75

    1. Initial program 17.7

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
    2. Applied simplify17.7

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

      \[\leadsto \frac{y.re \cdot x.im - x.re \cdot y.im}{\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))_*}}}\]
    5. Applied *-un-lft-identity17.7

      \[\leadsto \frac{\color{blue}{1 \cdot \left(y.re \cdot x.im - x.re \cdot y.im\right)}}{\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))_*}}\]
    6. Applied times-frac17.7

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

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

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

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

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

    if 8.927282505690149e+75 < y.re

    1. Initial program 37.1

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
    2. Applied simplify37.1

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

      \[\leadsto \frac{y.re \cdot x.im - x.re \cdot y.im}{\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))_*}}}\]
    5. Applied *-un-lft-identity37.1

      \[\leadsto \frac{\color{blue}{1 \cdot \left(y.re \cdot x.im - x.re \cdot y.im\right)}}{\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))_*}}\]
    6. Applied times-frac37.1

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

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

      \[\leadsto \frac{1}{\sqrt{y.im^2 + y.re^2}^*} \cdot \color{blue}{\frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.im^2 + y.re^2}^*}}\]
    9. Taylor expanded around 0 29.1

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

      \[\leadsto \color{blue}{\frac{(\left(\frac{x.re}{y.re}\right) \cdot \left(-y.im\right) + x.im)_*}{\sqrt{y.im^2 + y.re^2}^*}}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 2.6m)Debug logProfile

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