Average Error: 26.0 → 14.5
Time: 56.7s
Precision: 64
Internal Precision: 384
\[\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}\;\left(\frac{\sqrt[3]{(y.im \cdot x.im + \left(x.re \cdot y.re\right))_*}}{\sqrt[3]{\sqrt{y.re^2 + y.im^2}^*}} \cdot \frac{\sqrt[3]{(y.im \cdot x.im + \left(x.re \cdot y.re\right))_*}}{\sqrt{y.re^2 + y.im^2}^* \cdot \sqrt[3]{\sqrt{y.re^2 + y.im^2}^*}}\right) \cdot \frac{\sqrt[3]{(x.im \cdot y.im + \left(y.re \cdot x.re\right))_*}}{\sqrt[3]{\sqrt{y.re^2 + y.im^2}^*}} = -\infty:\\ \;\;\;\;\frac{x.im}{\sqrt{y.re^2 + y.im^2}^*}\\ \mathbf{if}\;\left(\frac{\sqrt[3]{(y.im \cdot x.im + \left(x.re \cdot y.re\right))_*}}{\sqrt[3]{\sqrt{y.re^2 + y.im^2}^*}} \cdot \frac{\sqrt[3]{(y.im \cdot x.im + \left(x.re \cdot y.re\right))_*}}{\sqrt{y.re^2 + y.im^2}^* \cdot \sqrt[3]{\sqrt{y.re^2 + y.im^2}^*}}\right) \cdot \frac{\sqrt[3]{(x.im \cdot y.im + \left(y.re \cdot x.re\right))_*}}{\sqrt[3]{\sqrt{y.re^2 + y.im^2}^*}} \le +\infty:\\ \;\;\;\;\sqrt{\frac{1}{\sqrt{y.re^2 + y.im^2}^*}} \cdot \left(\sqrt{\frac{1}{\sqrt{y.re^2 + y.im^2}^*}} \cdot \frac{(x.im \cdot y.im + \left(y.re \cdot x.re\right))_*}{\sqrt{y.re^2 + y.im^2}^*}\right)\\ \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 (* (* (/ (cbrt (fma y.im x.im (* x.re y.re))) (cbrt (hypot y.re y.im))) (/ (cbrt (fma y.im x.im (* x.re y.re))) (* (hypot y.re y.im) (cbrt (hypot y.re y.im))))) (/ (cbrt (fma x.im y.im (* y.re x.re))) (cbrt (hypot y.re y.im)))) < -inf.0

    1. Initial program 62.5

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

      \[\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 *-un-lft-identity62.5

      \[\leadsto \frac{\color{blue}{1 \cdot \left(x.re \cdot y.re + x.im \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-frac62.5

      \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.re \cdot y.re + x.im \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\]
    6. Applied simplify62.5

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

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

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

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

    if -inf.0 < (* (* (/ (cbrt (fma y.im x.im (* x.re y.re))) (cbrt (hypot y.re y.im))) (/ (cbrt (fma y.im x.im (* x.re y.re))) (* (hypot y.re y.im) (cbrt (hypot y.re y.im))))) (/ (cbrt (fma x.im y.im (* y.re x.re))) (cbrt (hypot y.re y.im)))) < +inf.0

    1. Initial program 17.2

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

      \[\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 *-un-lft-identity17.2

      \[\leadsto \frac{\color{blue}{1 \cdot \left(x.re \cdot y.re + x.im \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.2

      \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.re \cdot y.re + x.im \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\]
    6. Applied simplify17.2

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

      \[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \color{blue}{\frac{(x.im \cdot y.im + \left(y.re \cdot x.re\right))_*}{\sqrt{y.re^2 + y.im^2}^*}}\]
    8. Using strategy rm
    9. Applied add-sqr-sqrt6.3

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

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

    if +inf.0 < (* (* (/ (cbrt (fma y.im x.im (* x.re y.re))) (cbrt (hypot y.re y.im))) (/ (cbrt (fma y.im x.im (* x.re y.re))) (* (hypot y.re y.im) (cbrt (hypot y.re y.im))))) (/ (cbrt (fma x.im y.im (* y.re x.re))) (cbrt (hypot y.re y.im))))

    1. Initial program 62.9

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

      \[\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 *-un-lft-identity62.9

      \[\leadsto \frac{\color{blue}{1 \cdot \left(x.re \cdot y.re + x.im \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-frac62.9

      \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.re \cdot y.re + x.im \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\]
    6. Applied simplify62.9

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

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

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

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

Runtime

Time bar (total: 56.7s)Debug logProfile

herbie shell --seed '#(1070706311 3771791028 4128836681 4194990999 2341756049 504035650)' +o rules:numerics
(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))))