Average Error: 25.6 → 17.6
Time: 2.1m
Precision: 64
Internal Precision: 576
\[\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 \cdot y.re \le 6.438710500400648 \cdot 10^{+142}:\\ \;\;\;\;\frac{\frac{x.re \cdot y.re + x.im \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}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y.im \cdot x.im}{{y.re}^{2}} + \frac{x.re}{y.re}\\ \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 y.re) < 6.438710500400648e+142

    1. Initial program 17.7

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

      \[\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 associate-/r*17.6

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

    if 6.438710500400648e+142 < (* y.re y.re)

    1. Initial program 37.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-cube-cbrt37.5

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

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

      \[\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.re \cdot y.re + x.im \cdot y.im}{\sqrt[3]{y.re \cdot y.re + y.im \cdot y.im}}}\]
    6. Taylor expanded around inf 17.5

      \[\leadsto \color{blue}{\frac{y.im \cdot x.im}{{y.re}^{2}} + \frac{x.re}{y.re}}\]
  3. Recombined 2 regimes into one program.

Runtime

Time bar (total: 2.1m)Debug logProfile

herbie shell --seed '#(1072743783 989954326 4239155542 3782239461 3602631542 1719177920)' 
(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))))