Average Error: 0.0 → 0.1
Time: 4.8s
Precision: 64
\[\Re(\left(\frac{e^{x} + e^{-x}}{2} \cdot \cos y + \frac{e^{x} - e^{-x}}{2} \cdot \sin y i\right))\]
\[\frac{\mathsf{fma}\left(\sqrt[3]{e^{x}} \cdot \sqrt[3]{e^{x}}, \sqrt[3]{e^{x}}, e^{-x}\right)}{2} \cdot \cos y\]

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.0

    \[\Re(\left(\frac{e^{x} + e^{-x}}{2} \cdot \cos y + \frac{e^{x} - e^{-x}}{2} \cdot \sin y i\right))\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\frac{e^{x} + e^{-x}}{2} \cdot \cos y}\]
  3. Using strategy rm
  4. Applied add-cube-cbrt0.0

    \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{e^{x}} \cdot \sqrt[3]{e^{x}}\right) \cdot \sqrt[3]{e^{x}}} + e^{-x}}{2} \cdot \cos y\]
  5. Applied fma-def0.1

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\sqrt[3]{e^{x}} \cdot \sqrt[3]{e^{x}}, \sqrt[3]{e^{x}}, e^{-x}\right)}}{2} \cdot \cos y\]
  6. Final simplification0.1

    \[\leadsto \frac{\mathsf{fma}\left(\sqrt[3]{e^{x}} \cdot \sqrt[3]{e^{x}}, \sqrt[3]{e^{x}}, e^{-x}\right)}{2} \cdot \cos y\]

Reproduce

herbie shell --seed 2020113 +o rules:numerics
(FPCore (x y)
  :name "Euler formula real part (p55)"
  :precision binary64
  (re (complex (* (/ (+ (exp x) (exp (- x))) 2) (cos y)) (* (/ (- (exp x) (exp (- x))) 2) (sin y)))))