Average Error: 25.6 → 18.1
Time: 1.2m
Precision: 64
Internal Precision: 384
\[\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.06600929214972 \cdot 10^{+121}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{x.re \cdot y.im}{{y.re}^{2}}\\ \mathbf{if}\;y.re \le 3.2092839043956334 \cdot 10^{-17}:\\ \;\;\;\;\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}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{x.re \cdot y.im}{{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 2 regimes
  2. if y.re < -1.06600929214972e+121 or 3.2092839043956334e-17 < y.re

    1. Initial program 35.0

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

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

      \[\leadsto \frac{\color{blue}{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}}{\left(\sqrt[3]{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt[3]{y.re \cdot y.re + y.im \cdot y.im}\right) \cdot \sqrt[3]{y.re \cdot y.re + y.im \cdot y.im}}\]
    5. Applied times-frac35.2

      \[\leadsto \color{blue}{\frac{1}{\sqrt[3]{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt[3]{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt[3]{y.re \cdot y.re + y.im \cdot y.im}}}\]
    6. Taylor expanded around inf 17.9

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

    if -1.06600929214972e+121 < y.re < 3.2092839043956334e-17

    1. Initial program 18.3

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

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

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

      \[\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}}}\]
  3. Recombined 2 regimes into one program.

Runtime

Time bar (total: 1.2m)Debug logProfile

herbie shell --seed '#(1070386091 2509006183 1430610344 1025408621 36622005 1425925650)' 
(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))))