\[\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: 14.5 s
Input Error: 18.2
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.09829997f0 \\ (\left(\log \left(e^{{im}^3}\right)\right) * \frac{1}{3} + \left((\left({im}^{5}\right) * \frac{1}{60} + \left(im \cdot 2\right))_*\right))_* \cdot \left(\sin re \cdot \left(-0.5\right)\right) & \text{otherwise} \end{cases}\)

    if im < -0.09829997f0

    1. Started with
      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)\]
      2.0
    2. Using strategy rm
      2.0
    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.0

    if -0.09829997f0 < im

    1. Started with
      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)\]
      18.8
    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.1
    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.1
    4. Applied simplify to get
      \[\color{red}{\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)} \leadsto \color{blue}{(\left({im}^3\right) * \frac{1}{3} + \left((\left({im}^{5}\right) * \frac{1}{60} + \left(im \cdot 2\right))_*\right))_* \cdot \left(\sin re \cdot \left(-0.5\right)\right)}\]
      0.2
    5. Using strategy rm
      0.2
    6. Applied add-log-exp to get
      \[(\color{red}{\left({im}^3\right)} * \frac{1}{3} + \left((\left({im}^{5}\right) * \frac{1}{60} + \left(im \cdot 2\right))_*\right))_* \cdot \left(\sin re \cdot \left(-0.5\right)\right) \leadsto (\color{blue}{\left(\log \left(e^{{im}^3}\right)\right)} * \frac{1}{3} + \left((\left({im}^{5}\right) * \frac{1}{60} + \left(im \cdot 2\right))_*\right))_* \cdot \left(\sin re \cdot \left(-0.5\right)\right)\]
      1.0

  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)))))