Average Error: 0.0 → 0.0
Time: 21.7s
Precision: 64
Internal Precision: 320
\[\Re(\left(\frac{e^{x} + e^{-x}}{2} \cdot \cos y + \frac{e^{x} - e^{-x}}{2} \cdot \sin y i\right))\]
\[\Re(\left(\sqrt{\frac{e^{x} + e^{-x}}{2}} \cdot \left(\cos y \cdot \sqrt{\frac{e^{x} + e^{-x}}{2}}\right) + \sin y \cdot \frac{e^{x} - e^{-x}}{2} i\right))\]

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. Using strategy rm
  3. Applied add-sqr-sqrt0.0

    \[\leadsto \Re(\left(\color{blue}{\left(\sqrt{\frac{e^{x} + e^{-x}}{2}} \cdot \sqrt{\frac{e^{x} + e^{-x}}{2}}\right)} \cdot \cos y + \frac{e^{x} - e^{-x}}{2} \cdot \sin y i\right))\]
  4. Applied associate-*l*0.0

    \[\leadsto \Re(\left(\color{blue}{\sqrt{\frac{e^{x} + e^{-x}}{2}} \cdot \left(\sqrt{\frac{e^{x} + e^{-x}}{2}} \cdot \cos y\right)} + \frac{e^{x} - e^{-x}}{2} \cdot \sin y i\right))\]
  5. Final simplification0.0

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

Reproduce

herbie shell --seed 2019091 
(FPCore (x y)
  :name "Euler formula real part (p55)"
  (re (complex (* (/ (+ (exp x) (exp (- x))) 2) (cos y)) (* (/ (- (exp x) (exp (- x))) 2) (sin y)))))