Average Error: 26.0 → 6.4
Time: 41.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 -3.297785523352951 \cdot 10^{+180}:\\ \;\;\;\;\frac{-x.im}{\sqrt{y.re^2 + y.im^2}^*}\\ \mathbf{elif}\;y.re \le 4.7704829791947515 \cdot 10^{+204}:\\ \;\;\;\;\frac{x.re \cdot \frac{-y.im}{\sqrt{y.re^2 + y.im^2}^*} + \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \left(x.im \cdot y.re\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

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if y.re < -3.297785523352951e+180

    1. Initial program 42.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 add-sqr-sqrt42.7

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

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

      \[\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. Simplified42.7

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

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

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

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

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

    if -3.297785523352951e+180 < y.re < 4.7704829791947515e+204

    1. Initial program 22.0

      \[\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-sqrt22.0

      \[\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-identity22.0

      \[\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-frac22.0

      \[\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. Simplified22.0

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

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

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

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

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

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

    if 4.7704829791947515e+204 < y.re

    1. Initial program 41.3

      \[\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-sqrt41.3

      \[\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-identity41.3

      \[\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-frac41.3

      \[\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. Simplified41.3

      \[\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. Simplified30.0

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \le -3.297785523352951 \cdot 10^{+180}:\\ \;\;\;\;\frac{-x.im}{\sqrt{y.re^2 + y.im^2}^*}\\ \mathbf{elif}\;y.re \le 4.7704829791947515 \cdot 10^{+204}:\\ \;\;\;\;\frac{x.re \cdot \frac{-y.im}{\sqrt{y.re^2 + y.im^2}^*} + \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \left(x.im \cdot y.re\right)}{\sqrt{y.re^2 + y.im^2}^*}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{\sqrt{y.re^2 + y.im^2}^*}\\ \end{array}\]

Runtime

Time bar (total: 41.5s)Debug logProfile

herbie shell --seed 2018257 +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))))