Average Error: 25.9 → 13.8
Time: 43.1s
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}\;y.im \le 2.318183842350395 \cdot 10^{+90}:\\ \;\;\;\;\frac{\frac{y.re \cdot x.im - x.re \cdot y.im}{\sqrt{y.im^2 + y.re^2}^*}}{\sqrt{y.im^2 + y.re^2}^*}\\ \mathbf{else}:\\ \;\;\;\;\frac{(\left(\frac{x.im}{y.im}\right) \cdot y.re + \left(-x.re\right))_*}{\sqrt{y.im^2 + y.re^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 y.im < 2.318183842350395e+90

    1. Initial program 23.0

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
    2. Applied simplify23.0

      \[\leadsto \color{blue}{\frac{y.re \cdot x.im - x.re \cdot y.im}{(y.im \cdot y.im + \left(y.re \cdot y.re\right))_*}}\]
    3. Using strategy rm
    4. Applied add-sqr-sqrt23.0

      \[\leadsto \frac{y.re \cdot x.im - x.re \cdot y.im}{\color{blue}{\sqrt{(y.im \cdot y.im + \left(y.re \cdot y.re\right))_*} \cdot \sqrt{(y.im \cdot y.im + \left(y.re \cdot y.re\right))_*}}}\]
    5. Applied associate-/r*22.9

      \[\leadsto \color{blue}{\frac{\frac{y.re \cdot x.im - x.re \cdot y.im}{\sqrt{(y.im \cdot y.im + \left(y.re \cdot y.re\right))_*}}}{\sqrt{(y.im \cdot y.im + \left(y.re \cdot y.re\right))_*}}}\]
    6. Using strategy rm
    7. Applied fma-udef22.9

      \[\leadsto \frac{\frac{y.re \cdot x.im - x.re \cdot y.im}{\sqrt{(y.im \cdot y.im + \left(y.re \cdot y.re\right))_*}}}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}}\]
    8. Applied hypot-def22.9

      \[\leadsto \frac{\frac{y.re \cdot x.im - x.re \cdot y.im}{\sqrt{(y.im \cdot y.im + \left(y.re \cdot y.re\right))_*}}}{\color{blue}{\sqrt{y.im^2 + y.re^2}^*}}\]
    9. Using strategy rm
    10. Applied fma-udef22.9

      \[\leadsto \frac{\frac{y.re \cdot x.im - x.re \cdot y.im}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}}}{\sqrt{y.im^2 + y.re^2}^*}\]
    11. Applied hypot-def14.7

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

    if 2.318183842350395e+90 < y.im

    1. Initial program 38.5

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
    2. Applied simplify38.5

      \[\leadsto \color{blue}{\frac{y.re \cdot x.im - x.re \cdot y.im}{(y.im \cdot y.im + \left(y.re \cdot y.re\right))_*}}\]
    3. Using strategy rm
    4. Applied add-sqr-sqrt38.5

      \[\leadsto \frac{y.re \cdot x.im - x.re \cdot y.im}{\color{blue}{\sqrt{(y.im \cdot y.im + \left(y.re \cdot y.re\right))_*} \cdot \sqrt{(y.im \cdot y.im + \left(y.re \cdot y.re\right))_*}}}\]
    5. Applied associate-/r*38.5

      \[\leadsto \color{blue}{\frac{\frac{y.re \cdot x.im - x.re \cdot y.im}{\sqrt{(y.im \cdot y.im + \left(y.re \cdot y.re\right))_*}}}{\sqrt{(y.im \cdot y.im + \left(y.re \cdot y.re\right))_*}}}\]
    6. Using strategy rm
    7. Applied fma-udef38.5

      \[\leadsto \frac{\frac{y.re \cdot x.im - x.re \cdot y.im}{\sqrt{(y.im \cdot y.im + \left(y.re \cdot y.re\right))_*}}}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}}\]
    8. Applied hypot-def38.5

      \[\leadsto \frac{\frac{y.re \cdot x.im - x.re \cdot y.im}{\sqrt{(y.im \cdot y.im + \left(y.re \cdot y.re\right))_*}}}{\color{blue}{\sqrt{y.im^2 + y.re^2}^*}}\]
    9. Taylor expanded around inf 29.3

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

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

Runtime

Time bar (total: 43.1s)Debug logProfile

herbie shell --seed '#(1070355188 2193211668 3977393919 3454156579 3755371326 1656365382)' +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))))