\sin \left(x + \varepsilon\right) - \sin x
\frac{\sqrt[3]{{\left(-1 \cdot \left(\sin x \cdot {\left(\sin \varepsilon\right)}^{2}\right)\right)}^{3}}}{\cos \varepsilon + 1} + \cos x \cdot \sin \varepsilondouble f(double x, double eps) {
double r84288 = x;
double r84289 = eps;
double r84290 = r84288 + r84289;
double r84291 = sin(r84290);
double r84292 = sin(r84288);
double r84293 = r84291 - r84292;
return r84293;
}
double f(double x, double eps) {
double r84294 = -1.0;
double r84295 = x;
double r84296 = sin(r84295);
double r84297 = eps;
double r84298 = sin(r84297);
double r84299 = 2.0;
double r84300 = pow(r84298, r84299);
double r84301 = r84296 * r84300;
double r84302 = r84294 * r84301;
double r84303 = 3.0;
double r84304 = pow(r84302, r84303);
double r84305 = cbrt(r84304);
double r84306 = cos(r84297);
double r84307 = 1.0;
double r84308 = r84306 + r84307;
double r84309 = r84305 / r84308;
double r84310 = cos(r84295);
double r84311 = r84310 * r84298;
double r84312 = r84309 + r84311;
return r84312;
}




Bits error versus x




Bits error versus eps
Results
| Original | 37.0 |
|---|---|
| Target | 15.5 |
| Herbie | 0.4 |
Initial program 37.0
rmApplied sin-sum21.4
rmApplied *-un-lft-identity21.4
Applied *-un-lft-identity21.4
Applied distribute-lft-out--21.4
Simplified0.4
rmApplied flip--0.5
Applied associate-*r/0.5
Simplified0.4
rmApplied add-cbrt-cube0.4
Applied add-cbrt-cube0.4
Applied cbrt-unprod0.4
Simplified0.4
Final simplification0.4
herbie shell --seed 2020060
(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)))