Average Error: 25.8 → 17.6
Time: 1.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 -1.4163023509313036 \cdot 10^{+122} \lor \neg \left(y.re \le 1.0023458808847882 \cdot 10^{+115}\right):\\ \;\;\;\;\frac{x.im}{y.re} - \frac{y.im \cdot x.re}{{y.re}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x.im \cdot y.re - y.im \cdot x.re}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\\ \end{array}\]

Error

Bits error versus x.re

Bits error versus x.im

Bits error versus y.re

Bits error versus y.im

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if y.re < -1.4163023509313036e+122 or 1.0023458808847882e+115 < y.re

    1. Initial program 40.6

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

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

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

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

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

    if -1.4163023509313036e+122 < y.re < 1.0023458808847882e+115

    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 associate-/r*18.6

      \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification17.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \le -1.4163023509313036 \cdot 10^{+122} \lor \neg \left(y.re \le 1.0023458808847882 \cdot 10^{+115}\right):\\ \;\;\;\;\frac{x.im}{y.re} - \frac{y.im \cdot x.re}{{y.re}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x.im \cdot y.re - y.im \cdot x.re}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\\ \end{array}\]

Runtime

Time bar (total: 1.0m)Debug logProfile

herbie shell --seed 2018225 
(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))))