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

    if im < -0.12694146f0

    1. Started with
      \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right)\]
      0.3
    2. Applied simplify to get
      \[\color{red}{\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right)} \leadsto \color{blue}{\left(e^{-im} - e^{im}\right) \cdot \left(\cos re \cdot 0.5\right)}\]
      0.3
    3. Using strategy rm
      0.3
    4. Applied add-exp-log to get
      \[\color{red}{\left(e^{-im} - e^{im}\right)} \cdot \left(\cos re \cdot 0.5\right) \leadsto \color{blue}{e^{\log \left(e^{-im} - e^{im}\right)}} \cdot \left(\cos re \cdot 0.5\right)\]
      0.5

    if -0.12694146f0 < im

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

  1. Removed slow pow expressions

Original test:


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