\sin \left(x + \varepsilon\right) - \sin x
\sin x \cdot \log \left(e^{\frac{{\left(\cos \varepsilon\right)}^{3} - 1}{\cos \varepsilon \cdot \left(\cos \varepsilon + 1\right) + 1}}\right) + \cos x \cdot \sin \varepsilondouble f(double x, double eps) {
double r118475 = x;
double r118476 = eps;
double r118477 = r118475 + r118476;
double r118478 = sin(r118477);
double r118479 = sin(r118475);
double r118480 = r118478 - r118479;
return r118480;
}
double f(double x, double eps) {
double r118481 = x;
double r118482 = sin(r118481);
double r118483 = eps;
double r118484 = cos(r118483);
double r118485 = 3.0;
double r118486 = pow(r118484, r118485);
double r118487 = 1.0;
double r118488 = r118486 - r118487;
double r118489 = r118484 + r118487;
double r118490 = r118484 * r118489;
double r118491 = r118490 + r118487;
double r118492 = r118488 / r118491;
double r118493 = exp(r118492);
double r118494 = log(r118493);
double r118495 = r118482 * r118494;
double r118496 = cos(r118481);
double r118497 = sin(r118483);
double r118498 = r118496 * r118497;
double r118499 = r118495 + r118498;
return r118499;
}




Bits error versus x




Bits error versus eps
Results
| Original | 36.9 |
|---|---|
| Target | 15.0 |
| Herbie | 0.4 |
Initial program 36.9
rmApplied sin-sum21.7
rmApplied *-un-lft-identity21.7
Applied *-un-lft-identity21.7
Applied distribute-lft-out--21.7
Simplified0.4
rmApplied add-log-exp0.4
Applied add-log-exp0.4
Applied diff-log0.4
Simplified0.4
rmApplied flip3--0.4
Simplified0.4
Simplified0.4
Final simplification0.4
herbie shell --seed 2020001
(FPCore (x eps)
:name "2sin (example 3.3)"
:precision binary64
:herbie-target
(* 2 (* (cos (+ x (/ eps 2))) (sin (/ eps 2))))
(- (sin (+ x eps)) (sin x)))