Average Error: 59.0 → 0.2
Time: 39.7s
Precision: 64
Internal precision: 128
\[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right)\]
\[\left(-\left(2 \cdot im + \left(\frac{1}{3} \cdot {im}^{3} + \frac{1}{60} \cdot {im}^{5}\right)\right)\right) \cdot \left(\cos re \cdot 0.5\right)\]

Error

Bits error versus re

Bits error versus im

Target

Original59.0
Comparison9.9
Herbie0.2
\[ \begin{array}{l} \mathbf{if}\;\left|im\right| \lt 1:\\ \;\;\;\;-\cos re \cdot \left(\left(im + \left(\left(\frac{1}{6} \cdot im\right) \cdot im\right) \cdot im\right) + \left(\left(\left(\left(\frac{1}{120} \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right)\\ \end{array} \]

Derivation

  1. Initial program 59.0

    \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right)\]
  2. Applied simplify 59.0

    \[\leadsto \color{blue}{\left(e^{-im} - e^{im}\right) \cdot \left(\cos re \cdot 0.5\right)}\]
  3. Applied taylor 0.2

    \[\leadsto \left(-\left(2 \cdot im + \left(\frac{1}{3} \cdot {im}^{3} + \frac{1}{60} \cdot {im}^{5}\right)\right)\right) \cdot \left(\cos re \cdot 0.5\right)\]
  4. Taylor expanded around 0 0.2

    \[\leadsto \color{blue}{\left(-\left(2 \cdot im + \left(\frac{1}{3} \cdot {im}^{3} + \frac{1}{60} \cdot {im}^{5}\right)\right)\right)} \cdot \left(\cos re \cdot 0.5\right)\]
  5. Removed slow pow expressions

Runtime

Time bar (total: 39.7s) Debug log

Please include this information when filing a bug report:

herbie --seed '#(2686265705 1678913877 395117673 1068554205 4129704838 4233965609)'
(FPCore (re im)
  :name "math.sin on complex, imaginary part"

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

  (* (* 0.5 (cos re)) (- (exp (- 0 im)) (exp im))))