\[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)\]
Test:
math.cos on complex, imaginary part
Bits:
128 bits
Bits error versus re
Bits error versus im
Time: 16.7 s
Input Error: 19.1
Output Error: 1.0
Log:
Profile: 🕒
\(\begin{cases} \left(0.5 \cdot \sin re\right) \cdot {\left(e^{-im} - e^{im}\right)}^{1} & \text{when } im \le -0.12694146f0 \\ \left(0.5 \cdot \sin re\right) \cdot \left(-\left(\frac{1}{60} \cdot {im}^{5} + \left(2 \cdot im + \frac{1}{3} \cdot {im}^{3}\right)\right)\right) & \text{otherwise} \end{cases}\)

    if im < -0.12694146f0

    1. Started with
      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)\]
      2.2
    2. Using strategy rm
      2.2
    3. Applied pow1 to get
      \[\left(0.5 \cdot \sin re\right) \cdot \color{red}{\left(e^{-im} - e^{im}\right)} \leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{{\left(e^{-im} - e^{im}\right)}^{1}}\]
      2.2

    if -0.12694146f0 < im

    1. Started with
      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)\]
      19.7
    2. Applied taylor to get
      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \leadsto \left(0.5 \cdot \sin re\right) \cdot \left(-\left(\frac{1}{60} \cdot {im}^{5} + \left(2 \cdot im + \frac{1}{3} \cdot {im}^{3}\right)\right)\right)\]
      0.9
    3. Taylor expanded around 0 to get
      \[\left(0.5 \cdot \sin re\right) \cdot \color{red}{\left(-\left(\frac{1}{60} \cdot {im}^{5} + \left(2 \cdot im + \frac{1}{3} \cdot {im}^{3}\right)\right)\right)} \leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(-\left(\frac{1}{60} \cdot {im}^{5} + \left(2 \cdot im + \frac{1}{3} \cdot {im}^{3}\right)\right)\right)}\]
      0.9

  1. Removed slow pow expressions

Original test:


(lambda ((re default) (im default))
  #:name "math.cos on complex, imaginary part"
  (* (* 0.5 (sin re)) (- (exp (- im)) (exp im)))
  #:target
  (if (< (fabs im) 1) (- (* (sin re) (+ (+ im (* (* (* 1/6 im) im) im)) (* (* (* (* (* 1/120 im) im) im) im) im)))) (* (* 0.5 (sin re)) (- (exp (- im)) (exp im)))))