Average Error: 25.7 → 1.4
Time: 1.3m
Precision: 64
Internal Precision: 384
\[\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}\;\frac{\frac{x.im}{\sqrt{y.re^2 + y.im^2}^*}}{\frac{\sqrt{y.re^2 + y.im^2}^*}{y.re}} + \frac{\frac{y.im}{\sqrt{y.re^2 + y.im^2}^*}}{\frac{\sqrt{y.re^2 + y.im^2}^*}{-x.re}} \le 6.149619111825869 \cdot 10^{+241}:\\ \;\;\;\;\frac{\frac{x.im}{\sqrt{y.re^2 + y.im^2}^*}}{\frac{\sqrt{y.re^2 + y.im^2}^*}{y.re}} + \frac{\frac{y.im}{\sqrt{y.re^2 + y.im^2}^*}}{\frac{\sqrt{y.re^2 + y.im^2}^*}{-x.re}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re^2 + y.im^2}^*}}{\sqrt{y.re^2 + y.im^2}^*}\\ \end{array}\]

Error

Bits error versus x.re

Bits error versus x.im

Bits error versus y.re

Bits error versus y.im

Derivation

  1. Split input into 2 regimes
  2. if (+ (/ (/ x.im (hypot y.re y.im)) (/ (hypot y.re y.im) y.re)) (/ (/ y.im (hypot y.re y.im)) (/ (hypot y.re y.im) (- x.re)))) < 6.149619111825869e+241

    1. Initial program 26.1

      \[\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-sqrt26.1

      \[\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-identity26.1

      \[\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-frac26.1

      \[\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. Applied simplify26.1

      \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re^2 + y.im^2}^*}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
    7. Applied simplify17.0

      \[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \color{blue}{\frac{y.re \cdot x.im - x.re \cdot y.im}{\sqrt{y.re^2 + y.im^2}^*}}\]
    8. Using strategy rm
    9. Applied div-sub17.0

      \[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \color{blue}{\left(\frac{y.re \cdot x.im}{\sqrt{y.re^2 + y.im^2}^*} - \frac{x.re \cdot y.im}{\sqrt{y.re^2 + y.im^2}^*}\right)}\]
    10. Using strategy rm
    11. Applied sub-neg17.0

      \[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \color{blue}{\left(\frac{y.re \cdot x.im}{\sqrt{y.re^2 + y.im^2}^*} + \left(-\frac{x.re \cdot y.im}{\sqrt{y.re^2 + y.im^2}^*}\right)\right)}\]
    12. Applied distribute-rgt-in17.0

      \[\leadsto \color{blue}{\frac{y.re \cdot x.im}{\sqrt{y.re^2 + y.im^2}^*} \cdot \frac{1}{\sqrt{y.re^2 + y.im^2}^*} + \left(-\frac{x.re \cdot y.im}{\sqrt{y.re^2 + y.im^2}^*}\right) \cdot \frac{1}{\sqrt{y.re^2 + y.im^2}^*}}\]
    13. Applied simplify9.9

      \[\leadsto \color{blue}{\frac{\frac{x.im}{\sqrt{y.re^2 + y.im^2}^*}}{\frac{\sqrt{y.re^2 + y.im^2}^*}{y.re}}} + \left(-\frac{x.re \cdot y.im}{\sqrt{y.re^2 + y.im^2}^*}\right) \cdot \frac{1}{\sqrt{y.re^2 + y.im^2}^*}\]
    14. Applied simplify1.4

      \[\leadsto \frac{\frac{x.im}{\sqrt{y.re^2 + y.im^2}^*}}{\frac{\sqrt{y.re^2 + y.im^2}^*}{y.re}} + \color{blue}{\frac{\frac{y.im}{\sqrt{y.re^2 + y.im^2}^*}}{\frac{\sqrt{y.re^2 + y.im^2}^*}{-x.re}}}\]

    if 6.149619111825869e+241 < (+ (/ (/ x.im (hypot y.re y.im)) (/ (hypot y.re y.im) y.re)) (/ (/ y.im (hypot y.re y.im)) (/ (hypot y.re y.im) (- x.re))))

    1. Initial program 13.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 add-sqr-sqrt13.5

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re^2 + y.im^2}^*}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
    7. Applied simplify3.3

      \[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \color{blue}{\frac{y.re \cdot x.im - x.re \cdot y.im}{\sqrt{y.re^2 + y.im^2}^*}}\]
    8. Using strategy rm
    9. Applied associate-*r/3.2

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \left(y.re \cdot x.im - x.re \cdot y.im\right)}{\sqrt{y.re^2 + y.im^2}^*}}\]
    10. Applied simplify3.1

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

Runtime

Time bar (total: 1.3m)Debug logProfile

herbie shell --seed '#(1070609872 3456127585 2380521889 2328837196 1765472538 734540918)' +o rules:numerics
(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))))