Average Error: 25.9 → 24.2
Time: 22.5s
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.371158448840453 \cdot 10^{+123}:\\ \;\;\;\;\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} - x.re \cdot \frac{y.im}{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}} \cdot \frac{y.re}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} - \frac{x.re \cdot y.im}{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.371158448840453e+123

    1. Initial program 22.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 div-sub22.7

      \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity22.7

      \[\leadsto \frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} - \frac{x.re \cdot y.im}{\color{blue}{1 \cdot \left(y.re \cdot y.re + y.im \cdot y.im\right)}}\]
    6. Applied times-frac21.1

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

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

    if 1.371158448840453e+123 < y.re

    1. Initial program 42.5

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

      \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}}\]
    4. Using strategy rm
    5. Applied add-sqr-sqrt42.5

      \[\leadsto \frac{x.im \cdot y.re}{\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
    6. Applied times-frac40.3

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

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

Runtime

Time bar (total: 22.5s)Debug logProfile

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