Average Error: 26.2 → 26.1
Time: 18.0s
Precision: 64
Internal Precision: 128
\[\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}\;\frac{x.im \cdot y.im + x.re \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} \le 9.45419465169941 \cdot 10^{+264}:\\ \;\;\;\;\frac{\frac{x.im \cdot y.im + x.re \cdot y.re}{\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{x.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 (/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))) < 9.45419465169941e+264

    1. Initial program 14.4

      \[\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-sqrt14.4

      \[\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*14.3

      \[\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 9.45419465169941e+264 < (/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im)))

    1. Initial program 59.8

      \[\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-sqrt59.8

      \[\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*59.8

      \[\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}}}\]
    5. Taylor expanded around 0 59.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x.im \cdot y.im + x.re \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} \le 9.45419465169941 \cdot 10^{+264}:\\ \;\;\;\;\frac{\frac{x.im \cdot y.im + x.re \cdot y.re}{\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{x.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\\ \end{array}\]

Runtime

Time bar (total: 18.0s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes26.226.123.42.70.6%
herbie shell --seed 2018353 
(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))))