\frac{1 - \cos x}{\sin x}\tan \left(\frac{x}{2}\right)(FPCore (x) :precision binary64 (/ (- 1.0 (cos x)) (sin x)))
(FPCore (x) :precision binary64 (tan (/ x 2.0)))
double code(double x) {
return (1.0 - cos(x)) / sin(x);
}
double code(double x) {
return tan(x / 2.0);
}






Bits error versus x
Results
| Original | 29.9 |
|---|---|
| Target | 0.0 |
| Herbie | 0.0 |
| Alternative 1 | |
|---|---|
| Error | 59.5 |
| Cost | 64 |
| Alternative 2 | |
|---|---|
| Error | 59.5 |
| Cost | 64 |

Initial program 29.9
Simplified0.0
Simplified0.0
Final simplification0.0
herbie shell --seed 2021044
(FPCore (x)
:name "tanhf (example 3.4)"
:precision binary64
:herbie-expected 2
:herbie-target
(tan (/ x 2.0))
(/ (- 1.0 (cos x)) (sin x)))