\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)\left(0.5 \cdot \sin re\right) \cdot \mathsf{fma}\left(\frac{-1}{3}, {im}^{3}, \mathsf{fma}\left(im, -2, {im}^{5} \cdot \frac{-1}{60}\right)\right)double f(double re, double im) {
double r269307 = 0.5;
double r269308 = re;
double r269309 = sin(r269308);
double r269310 = r269307 * r269309;
double r269311 = im;
double r269312 = -r269311;
double r269313 = exp(r269312);
double r269314 = exp(r269311);
double r269315 = r269313 - r269314;
double r269316 = r269310 * r269315;
return r269316;
}
double f(double re, double im) {
double r269317 = 0.5;
double r269318 = re;
double r269319 = sin(r269318);
double r269320 = r269317 * r269319;
double r269321 = -0.3333333333333333;
double r269322 = im;
double r269323 = 3.0;
double r269324 = pow(r269322, r269323);
double r269325 = -2.0;
double r269326 = 5.0;
double r269327 = pow(r269322, r269326);
double r269328 = -0.016666666666666666;
double r269329 = r269327 * r269328;
double r269330 = fma(r269322, r269325, r269329);
double r269331 = fma(r269321, r269324, r269330);
double r269332 = r269320 * r269331;
return r269332;
}




Bits error versus re




Bits error versus im
| Original | 43.3 |
|---|---|
| Target | 0.3 |
| Herbie | 0.7 |
Initial program 43.3
Taylor expanded around 0 0.7
Simplified0.7
Final simplification0.7
herbie shell --seed 2019350 +o rules:numerics
(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))))