\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 r95565 = x;
double r95566 = eps;
double r95567 = r95565 + r95566;
double r95568 = sin(r95567);
double r95569 = sin(r95565);
double r95570 = r95568 - r95569;
return r95570;
}
double f(double x, double eps) {
double r95571 = x;
double r95572 = sin(r95571);
double r95573 = eps;
double r95574 = cos(r95573);
double r95575 = 3.0;
double r95576 = pow(r95574, r95575);
double r95577 = 1.0;
double r95578 = r95576 - r95577;
double r95579 = r95574 + r95577;
double r95580 = r95574 * r95579;
double r95581 = r95580 + r95577;
double r95582 = r95578 / r95581;
double r95583 = exp(r95582);
double r95584 = log(r95583);
double r95585 = r95572 * r95584;
double r95586 = cos(r95571);
double r95587 = sin(r95573);
double r95588 = r95586 * r95587;
double r95589 = r95585 + r95588;
return r95589;
}




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)))