Average Error: 43.2 → 30.1
Time: 28.1s
Precision: 64
Internal Precision: 1344
\[\Im(\left(\frac{e^{x} + e^{-x}}{2} \cdot \cos y + \frac{e^{x} - e^{-x}}{2} \cdot \sin y i\right))\]
\[\begin{array}{l} \mathbf{if}\;x \le -4.4799144924782895 \cdot 10^{-13}:\\ \;\;\;\;\frac{1}{\frac{2}{\sqrt[3]{(\left(e^{x}\right) \cdot \left(\sin y\right) + \left(-\frac{\sin y}{e^{x}}\right))_*} \cdot \left(\sqrt[3]{(\left(e^{x}\right) \cdot \left(\sin y\right) + \left(-\frac{\sin y}{e^{x}}\right))_*} \cdot \sqrt[3]{(\left(e^{x}\right) \cdot \left(\sin y\right) + \left(-\frac{\sin y}{e^{x}}\right))_*}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{(\left(\frac{y}{x} - \frac{x}{y}\right) \cdot \frac{1}{6} + \left(\frac{\frac{1}{x}}{y}\right))_*}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Derivation

  1. Split input into 2 regimes
  2. if x < -4.4799144924782895e-13

    1. Initial program 13.8

      \[\Im(\left(\frac{e^{x} + e^{-x}}{2} \cdot \cos y + \frac{e^{x} - e^{-x}}{2} \cdot \sin y i\right))\]
    2. Initial simplification14.2

      \[\leadsto \frac{e^{x} \cdot \sin y - \frac{\sin y}{e^{x}}}{2}\]
    3. Using strategy rm
    4. Applied fma-neg13.9

      \[\leadsto \frac{\color{blue}{(\left(e^{x}\right) \cdot \left(\sin y\right) + \left(-\frac{\sin y}{e^{x}}\right))_*}}{2}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity13.9

      \[\leadsto \frac{\color{blue}{1 \cdot (\left(e^{x}\right) \cdot \left(\sin y\right) + \left(-\frac{\sin y}{e^{x}}\right))_*}}{2}\]
    7. Applied associate-/l*14.2

      \[\leadsto \color{blue}{\frac{1}{\frac{2}{(\left(e^{x}\right) \cdot \left(\sin y\right) + \left(-\frac{\sin y}{e^{x}}\right))_*}}}\]
    8. Using strategy rm
    9. Applied add-cube-cbrt14.4

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

    if -4.4799144924782895e-13 < x

    1. Initial program 44.0

      \[\Im(\left(\frac{e^{x} + e^{-x}}{2} \cdot \cos y + \frac{e^{x} - e^{-x}}{2} \cdot \sin y i\right))\]
    2. Initial simplification44.1

      \[\leadsto \frac{e^{x} \cdot \sin y - \frac{\sin y}{e^{x}}}{2}\]
    3. Using strategy rm
    4. Applied fma-neg44.1

      \[\leadsto \frac{\color{blue}{(\left(e^{x}\right) \cdot \left(\sin y\right) + \left(-\frac{\sin y}{e^{x}}\right))_*}}{2}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity44.1

      \[\leadsto \frac{\color{blue}{1 \cdot (\left(e^{x}\right) \cdot \left(\sin y\right) + \left(-\frac{\sin y}{e^{x}}\right))_*}}{2}\]
    7. Applied associate-/l*44.1

      \[\leadsto \color{blue}{\frac{1}{\frac{2}{(\left(e^{x}\right) \cdot \left(\sin y\right) + \left(-\frac{\sin y}{e^{x}}\right))_*}}}\]
    8. Taylor expanded around 0 30.5

      \[\leadsto \frac{1}{\color{blue}{\left(\frac{1}{6} \cdot \frac{y}{x} + \frac{1}{x \cdot y}\right) - \frac{1}{6} \cdot \frac{x}{y}}}\]
    9. Simplified30.6

      \[\leadsto \frac{1}{\color{blue}{(\left(\frac{y}{x} - \frac{x}{y}\right) \cdot \frac{1}{6} + \left(\frac{\frac{1}{x}}{y}\right))_*}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification30.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -4.4799144924782895 \cdot 10^{-13}:\\ \;\;\;\;\frac{1}{\frac{2}{\sqrt[3]{(\left(e^{x}\right) \cdot \left(\sin y\right) + \left(-\frac{\sin y}{e^{x}}\right))_*} \cdot \left(\sqrt[3]{(\left(e^{x}\right) \cdot \left(\sin y\right) + \left(-\frac{\sin y}{e^{x}}\right))_*} \cdot \sqrt[3]{(\left(e^{x}\right) \cdot \left(\sin y\right) + \left(-\frac{\sin y}{e^{x}}\right))_*}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{(\left(\frac{y}{x} - \frac{x}{y}\right) \cdot \frac{1}{6} + \left(\frac{\frac{1}{x}}{y}\right))_*}\\ \end{array}\]

Runtime

Time bar (total: 28.1s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes30.830.128.02.823.8%
herbie shell --seed 2018355 +o rules:numerics
(FPCore (x y)
  :name "Euler formula imaginary part (p55)"
  (im (complex (* (/ (+ (exp x) (exp (- x))) 2) (cos y)) (* (/ (- (exp x) (exp (- x))) 2) (sin y)))))