\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)\left(0.5 \cdot \sin re\right) \cdot \left(\left({im}^{5} \cdot \frac{-1}{60} + \frac{-1}{3} \cdot {im}^{3}\right) - 2 \cdot im\right)double f(double re, double im) {
double r205018 = 0.5;
double r205019 = re;
double r205020 = sin(r205019);
double r205021 = r205018 * r205020;
double r205022 = im;
double r205023 = -r205022;
double r205024 = exp(r205023);
double r205025 = exp(r205022);
double r205026 = r205024 - r205025;
double r205027 = r205021 * r205026;
return r205027;
}
double f(double re, double im) {
double r205028 = 0.5;
double r205029 = re;
double r205030 = sin(r205029);
double r205031 = r205028 * r205030;
double r205032 = im;
double r205033 = 5.0;
double r205034 = pow(r205032, r205033);
double r205035 = -0.016666666666666666;
double r205036 = r205034 * r205035;
double r205037 = -0.3333333333333333;
double r205038 = 3.0;
double r205039 = pow(r205032, r205038);
double r205040 = r205037 * r205039;
double r205041 = r205036 + r205040;
double r205042 = 2.0;
double r205043 = r205042 * r205032;
double r205044 = r205041 - r205043;
double r205045 = r205031 * r205044;
return r205045;
}




Bits error versus re




Bits error versus im
Results
| Original | 43.6 |
|---|---|
| Target | 0.2 |
| Herbie | 0.7 |
Initial program 43.6
Taylor expanded around 0 0.7
Simplified0.7
rmApplied associate--r+0.7
Simplified0.7
Final simplification0.7
herbie shell --seed 2019347
(FPCore (re im)
:name "math.cos on complex, imaginary part"
:precision binary64
:herbie-target
(if (< (fabs im) 1) (- (* (sin re) (+ (+ im (* (* (* 0.16666666666666666 im) im) im)) (* (* (* (* (* 0.008333333333333333 im) im) im) im) im)))) (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))
(* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))