\[\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right)\]
Test:
math.cos on complex, real part
Bits:
128 bits
Bits error versus re
Bits error versus im
Time: 12.6 s
Input Error: 0.0
Output Error: 0.1
Log:
Profile: 🕒
\(\left(0.5 \cdot \cos re\right) \cdot (e^{\log_* (1 + \left(e^{-im} + e^{im}\right))} - 1)^*\)
  1. Started with
    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right)\]
    0.0
  2. Using strategy rm
    0.0
  3. Applied expm1-log1p-u to get
    \[\left(0.5 \cdot \cos re\right) \cdot \color{red}{\left(e^{-im} + e^{im}\right)} \leadsto \left(0.5 \cdot \cos re\right) \cdot \color{blue}{(e^{\log_* (1 + \left(e^{-im} + e^{im}\right))} - 1)^*}\]
    0.1

  4. Removed slow pow expressions

Original test:


(lambda ((re default) (im default))
  #:name "math.cos on complex, real part"
  (* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))