Average Error: 25.9 → 26.0
Time: 23.0s
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 3.312795530944021 \cdot 10^{+58}:\\ \;\;\;\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.im \cdot y.im + y.re \cdot y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{y.im \cdot y.im + y.re \cdot y.re}} \cdot x.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 < 3.312795530944021e+58

    1. Initial program 22.6

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

    if 3.312795530944021e+58 < y.re

    1. Initial program 37.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-sqr-sqrt37.0

      \[\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-identity37.0

      \[\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-frac37.0

      \[\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. Taylor expanded around inf 37.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \le 3.312795530944021 \cdot 10^{+58}:\\ \;\;\;\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.im \cdot y.im + y.re \cdot y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{y.im \cdot y.im + y.re \cdot y.re}} \cdot x.im\\ \end{array}\]

Runtime

Time bar (total: 23.0s)Debug logProfile

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