Average Error: 25.9 → 11.4
Time: 1.3m
Precision: 64
Internal Precision: 384
\[\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
\[\begin{array}{l} \mathbf{if}\;y.re \le -2.227620296543906 \cdot 10^{+84}:\\ \;\;\;\;\frac{(\left(\frac{y.im}{y.re}\right) \cdot \left(-x.im\right) + \left(-x.re\right))_*}{\sqrt{y.re^2 + y.im^2}^*}\\ \mathbf{if}\;y.re \le 2.168394667707026 \cdot 10^{+41}:\\ \;\;\;\;\frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \frac{(x.im \cdot y.im + \left(y.re \cdot x.re\right))_*}{\sqrt{y.re^2 + y.im^2}^*}\\ \mathbf{else}:\\ \;\;\;\;\frac{(\left(\frac{y.im}{y.re}\right) \cdot x.im + x.re)_*}{\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.227620296543906e+84

    1. Initial program 37.2

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

      \[\leadsto \frac{x.re \cdot y.re + x.im \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-identity37.2

      \[\leadsto \frac{\color{blue}{1 \cdot \left(x.re \cdot y.re + x.im \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-frac37.2

      \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.re \cdot y.re + x.im \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\]
    6. Applied simplify37.2

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

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

      \[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \frac{(x.im \cdot y.im + \left(y.re \cdot x.re\right))_*}{\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.3

      \[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \frac{\color{blue}{1 \cdot (x.im \cdot y.im + \left(y.re \cdot x.re\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.3

      \[\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{(x.im \cdot y.im + \left(y.re \cdot x.re\right))_*}{\sqrt[3]{\sqrt{y.re^2 + y.im^2}^*}}\right)}\]
    12. Taylor expanded around -inf 14.5

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

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

    if -2.227620296543906e+84 < y.re < 2.168394667707026e+41

    1. Initial program 18.3

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

      \[\leadsto \frac{x.re \cdot y.re + x.im \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.3

      \[\leadsto \frac{\color{blue}{1 \cdot \left(x.re \cdot y.re + x.im \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.4

      \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.re \cdot y.re + x.im \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\]
    6. Applied simplify18.4

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

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

    if 2.168394667707026e+41 < y.re

    1. Initial program 35.4

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

      \[\leadsto \frac{x.re \cdot y.re + x.im \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-identity35.4

      \[\leadsto \frac{\color{blue}{1 \cdot \left(x.re \cdot y.re + x.im \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-frac35.4

      \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.re \cdot y.re + x.im \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\]
    6. Applied simplify35.4

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

      \[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \color{blue}{\frac{(x.im \cdot y.im + \left(y.re \cdot x.re\right))_*}{\sqrt{y.re^2 + y.im^2}^*}}\]
    8. Using strategy rm
    9. Applied add-cube-cbrt24.3

      \[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \frac{(x.im \cdot y.im + \left(y.re \cdot x.re\right))_*}{\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-identity24.3

      \[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \frac{\color{blue}{1 \cdot (x.im \cdot y.im + \left(y.re \cdot x.re\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-frac24.3

      \[\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{(x.im \cdot y.im + \left(y.re \cdot x.re\right))_*}{\sqrt[3]{\sqrt{y.re^2 + y.im^2}^*}}\right)}\]
    12. Taylor expanded around inf 15.2

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

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

Runtime

Time bar (total: 1.3m)Debug logProfile

herbie shell --seed '#(1070991898 1055468627 4280279443 640792587 928206309 3646738750)' +o rules:numerics
(FPCore (x.re x.im y.re y.im)
  :name "_divideComplex, real part"
  (/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))))