\sin \left(x + \varepsilon\right) - \sin x
\sin \varepsilon \cdot \cos x - \frac{\sin x \cdot \left(\sin \varepsilon \cdot \sin \varepsilon\right)}{e^{\log \left(\cos \varepsilon + 1\right)}}(FPCore (x eps) :precision binary64 (- (sin (+ x eps)) (sin x)))
(FPCore (x eps) :precision binary64 (- (* (sin eps) (cos x)) (/ (* (sin x) (* (sin eps) (sin eps))) (exp (log (+ (cos eps) 1.0))))))
double code(double x, double eps) {
return sin(x + eps) - sin(x);
}
double code(double x, double eps) {
return (sin(eps) * cos(x)) - ((sin(x) * (sin(eps) * sin(eps))) / exp(log(cos(eps) + 1.0)));
}


















Bits error versus x


















Bits error versus eps
Results
| Original | 37.3 |
|---|---|
| Target | 15.1 |
| Herbie | 0.4 |
| Alternative 1 | |
|---|---|
| Error | 0.4 |
| Cost | 39168 |
| Alternative 2 | |
|---|---|
| Error | 0.4 |
| Cost | 32576 |
| Alternative 3 | |
|---|---|
| Error | 0.4 |
| Cost | 26176 |
| Alternative 4 | |
|---|---|
| Error | 14.1 |
| Cost | 26690 |
| Alternative 5 | |
|---|---|
| Error | 14.1 |
| Cost | 19976 |
| Alternative 6 | |
|---|---|
| Error | 15.1 |
| Cost | 13504 |
| Alternative 7 | |
|---|---|
| Error | 15.0 |
| Cost | 13576 |
| Alternative 8 | |
|---|---|
| Error | 15.1 |
| Cost | 13320 |
| Alternative 9 | |
|---|---|
| Error | 15.3 |
| Cost | 6920 |
| Alternative 10 | |
|---|---|
| Error | 29.0 |
| Cost | 6464 |
| Alternative 11 | |
|---|---|
| Error | 42.9 |
| Cost | 706 |
| Alternative 12 | |
|---|---|
| Error | 44.1 |
| Cost | 385 |
| Alternative 13 | |
|---|---|
| Error | 45.4 |
| Cost | 64 |
| Alternative 14 | |
|---|---|
| Error | 61.3 |
| Cost | 64 |


Initial program 37.3
rmApplied sin-sum_binary64_157521.9
rmApplied *-un-lft-identity_binary64_144221.9
Applied *-un-lft-identity_binary64_144221.9
Applied distribute-lft-out--_binary64_139421.9
Simplified0.4
rmApplied flip-+_binary64_14160.5
Applied associate-*r/_binary64_13840.5
Simplified0.4
rmApplied add-exp-log_binary64_14800.4
Simplified0.4
Final simplification0.4
herbie shell --seed 2021040
(FPCore (x eps)
:name "2sin (example 3.3)"
:precision binary64
:herbie-target
(* 2.0 (* (cos (+ x (/ eps 2.0))) (sin (/ eps 2.0))))
(- (sin (+ x eps)) (sin x)))