Average Error: 25.8 → 10.9
Time: 2.6m
Precision: 64
Internal Precision: 320
\[\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.9830793252751902 \cdot 10^{+141}:\\ \;\;\;\;\frac{(\left(\frac{x.re}{y.re}\right) \cdot y.im + \left(-x.im\right))_*}{\sqrt{y.im^2 + y.re^2}^*}\\ \mathbf{if}\;y.re \le 7.202117007000063 \cdot 10^{+42}:\\ \;\;\;\;\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 < -2.9830793252751902e+141

    1. Initial program 43.6

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

      \[\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-sqrt43.6

      \[\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-identity43.6

      \[\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-frac43.6

      \[\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 simplify43.6

      \[\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 simplify28.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-sqrt28.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*28.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 11.5

      \[\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 simplify7.8

      \[\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 -2.9830793252751902e+141 < y.re < 7.202117007000063e+42

    1. Initial program 18.2

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

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

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

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

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

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

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

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

      \[\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 7.202117007000063e+42 < y.re

    1. Initial program 36.2

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

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

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

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

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

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

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

      \[\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*24.4

      \[\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 15.4

      \[\leadsto \frac{1}{\sqrt{y.im^2 + y.re^2}^*} \cdot \color{blue}{\left(x.im - \frac{x.re \cdot y.im}{y.re}\right)}\]
    13. Applied simplify12.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 '#(1071215679 2002590028 935158157 1944352234 2656991306 2955288481)' +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))))