Average Error: 43.9 → 0.8
Time: 41.9s
Precision: 64
$\left(\frac{1}{2} \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)$
$\left({im}^{5} \cdot \frac{-1}{60} - im \cdot \left(2 + \frac{1}{3} \cdot \left(im \cdot im\right)\right)\right) \cdot \left(\frac{1}{2} \cdot \sin re\right)$
\left(\frac{1}{2} \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)
\left({im}^{5} \cdot \frac{-1}{60} - im \cdot \left(2 + \frac{1}{3} \cdot \left(im \cdot im\right)\right)\right) \cdot \left(\frac{1}{2} \cdot \sin re\right)
double f(double re, double im) {
double r37080459 = 0.5;
double r37080460 = re;
double r37080461 = sin(r37080460);
double r37080462 = r37080459 * r37080461;
double r37080463 = im;
double r37080464 = -r37080463;
double r37080465 = exp(r37080464);
double r37080466 = exp(r37080463);
double r37080467 = r37080465 - r37080466;
double r37080468 = r37080462 * r37080467;
return r37080468;
}


double f(double re, double im) {
double r37080469 = im;
double r37080470 = 5.0;
double r37080471 = pow(r37080469, r37080470);
double r37080472 = -0.016666666666666666;
double r37080473 = r37080471 * r37080472;
double r37080474 = 2.0;
double r37080475 = 0.3333333333333333;
double r37080476 = r37080469 * r37080469;
double r37080477 = r37080475 * r37080476;
double r37080478 = r37080474 + r37080477;
double r37080479 = r37080469 * r37080478;
double r37080480 = r37080473 - r37080479;
double r37080481 = 0.5;
double r37080482 = re;
double r37080483 = sin(r37080482);
double r37080484 = r37080481 * r37080483;
double r37080485 = r37080480 * r37080484;
return r37080485;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 43.9

$\left(\frac{1}{2} \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)$
2. Taylor expanded around 0 0.8

$\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \color{blue}{\left(-\left(\frac{1}{60} \cdot {im}^{5} + \left(\frac{1}{3} \cdot {im}^{3} + 2 \cdot im\right)\right)\right)}$
3. Simplified0.8

$\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \color{blue}{\left({im}^{5} \cdot \frac{-1}{60} - im \cdot \left(\left(im \cdot im\right) \cdot \frac{1}{3} + 2\right)\right)}$
4. Final simplification0.8

$\leadsto \left({im}^{5} \cdot \frac{-1}{60} - im \cdot \left(2 + \frac{1}{3} \cdot \left(im \cdot im\right)\right)\right) \cdot \left(\frac{1}{2} \cdot \sin re\right)$

# Reproduce

herbie shell --seed 1
(FPCore (re im)
:name "Complex sine and cosine"
(* (* 1/2 (sin re)) (- (exp (- im)) (exp im))))