\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right)\frac{\cos re \cdot 0.5}{e^{im}} + \left(\cos re \cdot 0.5\right) \cdot e^{im}(FPCore (re im) :precision binary64 (* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))
(FPCore (re im) :precision binary64 (+ (/ (* (cos re) 0.5) (exp im)) (* (* (cos re) 0.5) (exp im))))
double code(double re, double im) {
return (0.5 * cos(re)) * (exp(-im) + exp(im));
}
double code(double re, double im) {
return ((cos(re) * 0.5) / exp(im)) + ((cos(re) * 0.5) * exp(im));
}







Bits error versus re







Bits error versus im
Results
| Alternative 1 | |
|---|---|
| Error | 0.0 |
| Cost | 19712 |
| Alternative 2 | |
|---|---|
| Error | 0.9 |
| Cost | 6976 |
| Alternative 3 | |
|---|---|
| Error | 1.2 |
| Cost | 6464 |
| Alternative 4 | |
|---|---|
| Error | 29.4 |
| Cost | 64 |

Initial program 0.0
rmApplied distribute-rgt-in_binary64_10510.0
Simplified0.0
Simplified0.0
Simplified0.0
Final simplification0.0
herbie shell --seed 2021044
(FPCore (re im)
:name "math.cos on complex, real part"
:precision binary64
(* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))