Average Error: 43.5 → 30.4
Time: 31.8s
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}\;y \le 3.20334169337363 \cdot 10^{+40}:\\ \;\;\;\;\frac{2 \cdot \left(x \cdot y\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(\sin y \cdot e^{x}\right) \cdot \left(\sin y \cdot e^{x}\right) - \frac{\sin y}{e^{x}} \cdot \frac{\sin y}{e^{x}}}{\frac{\sin y}{e^{x}} + \sin y \cdot e^{x}}}{2}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Derivation

  1. Split input into 2 regimes
  2. if y < 3.20334169337363e+40

    1. Initial program 39.7

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

      \[\leadsto \frac{e^{x} \cdot \sin y - \frac{\sin y}{e^{x}}}{2}\]
    3. Taylor expanded around 0 23.1

      \[\leadsto \frac{\color{blue}{2 \cdot \left(x \cdot y\right)}}{2}\]

    if 3.20334169337363e+40 < y

    1. Initial program 57.9

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le 3.20334169337363 \cdot 10^{+40}:\\ \;\;\;\;\frac{2 \cdot \left(x \cdot y\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(\sin y \cdot e^{x}\right) \cdot \left(\sin y \cdot e^{x}\right) - \frac{\sin y}{e^{x}} \cdot \frac{\sin y}{e^{x}}}{\frac{\sin y}{e^{x}} + \sin y \cdot e^{x}}}{2}\\ \end{array}\]

Runtime

Time bar (total: 31.8s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes31.130.428.42.728.2%
herbie shell --seed 2018352 +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)))))