Average Error: 25.4 → 12.6
Time: 1.3m
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 -9.732197614405221 \cdot 10^{+100}:\\ \;\;\;\;\frac{-x.im}{\sqrt{y.re^2 + y.im^2}^*}\\ \mathbf{if}\;y.re \le 1.5926874000492556 \cdot 10^{+144}:\\ \;\;\;\;\frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \frac{(y.re \cdot x.im + \left(-x.re \cdot y.im\right))_*}{\sqrt{y.re^2 + y.im^2}^*}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{\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 3 regimes
  2. if y.re < -9.732197614405221e+100

    1. Initial program 39.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-sqrt39.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-identity39.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-frac39.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 simplify39.5

      \[\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 simplify25.6

      \[\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. Taylor expanded around -inf 17.3

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

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

    if -9.732197614405221e+100 < y.re < 1.5926874000492556e+144

    1. Initial program 17.9

      \[\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-sqrt17.9

      \[\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-identity17.9

      \[\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-frac17.9

      \[\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 simplify17.9

      \[\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 simplify11.2

      \[\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 fma-neg11.2

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

    if 1.5926874000492556e+144 < 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 add-sqr-sqrt42.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-identity42.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-frac42.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 simplify42.5

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

      \[\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. Taylor expanded around inf 13.3

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

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

Runtime

Time bar (total: 1.3m)Debug logProfile

herbie shell --seed '#(1071979731 1496239409 439705970 2863295848 982327776 189749553)' +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))))