Average Error: 25.3 → 16.8
Time: 1.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 \le -9.621588064409836 \cdot 10^{+60} \lor \neg \left(y.re \le 2.7932086783743507 \cdot 10^{+72}\right):\\ \;\;\;\;\frac{x.re + \frac{x.im \cdot y.im}{y.re}}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im \cdot y.im + x.re \cdot y.re}{y.im \cdot y.im + y.re \cdot 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 < -9.621588064409836e+60 or 2.7932086783743507e+72 < y.re

    1. Initial program 36.5

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

      \[\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 *-un-lft-identity36.5

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

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

      \[\leadsto \frac{1}{\color{blue}{y.re}} \cdot \frac{x.re \cdot y.re + x.im \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
    7. Applied simplify41.9

      \[\leadsto \color{blue}{\frac{x.re + \frac{y.im \cdot x.im}{y.re}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\]
    8. Taylor expanded around inf 15.4

      \[\leadsto \frac{x.re + \frac{y.im \cdot x.im}{y.re}}{\color{blue}{y.re}}\]

    if -9.621588064409836e+60 < y.re < 2.7932086783743507e+72

    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}\]
  3. Recombined 2 regimes into one program.
  4. Applied simplify16.8

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;y.re \le -9.621588064409836 \cdot 10^{+60} \lor \neg \left(y.re \le 2.7932086783743507 \cdot 10^{+72}\right):\\ \;\;\;\;\frac{x.re + \frac{x.im \cdot y.im}{y.re}}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im \cdot y.im + x.re \cdot y.re}{y.im \cdot y.im + y.re \cdot y.re}\\ \end{array}}\]

Runtime

Time bar (total: 1.1m)Debug logProfile

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