Average Error: 25.7 → 10.5
Time: 3.0m
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 -2.488570585261661 \cdot 10^{+120}:\\ \;\;\;\;\frac{(\left(\frac{x.re}{y.re}\right) \cdot y.im + \left(-x.im\right))_*}{\sqrt{y.re^2 + y.im^2}^*}\\ \mathbf{if}\;y.re \le 3.7339020399067086 \cdot 10^{+91}:\\ \;\;\;\;\frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \frac{\frac{y.re \cdot x.im - x.re \cdot y.im}{\sqrt{\sqrt{y.re^2 + y.im^2}^*}}}{\sqrt{\sqrt{y.re^2 + y.im^2}^*}}\\ \mathbf{else}:\\ \;\;\;\;\frac{(\left(\frac{x.re}{y.re}\right) \cdot \left(-y.im\right) + x.im)_*}{\sqrt{y.re^2 + y.im^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 < -2.488570585261661e+120

    1. Initial program 40.4

      \[\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-sqrt40.4

      \[\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-identity40.4

      \[\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-frac40.4

      \[\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. Applied simplify40.4

      \[\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. Applied simplify27.5

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

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

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

      \[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \color{blue}{\left(\frac{1}{\sqrt[3]{\sqrt{y.re^2 + y.im^2}^*} \cdot \sqrt[3]{\sqrt{y.re^2 + y.im^2}^*}} \cdot \frac{y.re \cdot x.im - x.re \cdot y.im}{\sqrt[3]{\sqrt{y.re^2 + y.im^2}^*}}\right)}\]
    12. Taylor expanded around -inf 12.3

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

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

    if -2.488570585261661e+120 < y.re < 3.7339020399067086e+91

    1. Initial program 18.7

      \[\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-sqrt18.7

      \[\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-identity18.7

      \[\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-frac18.7

      \[\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. Applied simplify18.7

      \[\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. Applied simplify11.3

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

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

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

    if 3.7339020399067086e+91 < y.re

    1. Initial program 38.2

      \[\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-sqrt38.2

      \[\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-identity38.2

      \[\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-frac38.2

      \[\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. Applied simplify38.2

      \[\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. Applied simplify25.5

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

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

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

      \[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \color{blue}{\left(\frac{1}{\sqrt[3]{\sqrt{y.re^2 + y.im^2}^*} \cdot \sqrt[3]{\sqrt{y.re^2 + y.im^2}^*}} \cdot \frac{y.re \cdot x.im - x.re \cdot y.im}{\sqrt[3]{\sqrt{y.re^2 + y.im^2}^*}}\right)}\]
    12. Taylor expanded around inf 13.0

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

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

Runtime

Time bar (total: 3.0m)Debug logProfile

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