\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 (((double) (1.0 - ((double) cos(x)))) / ((double) sin(x)));
}
double code(double x) {
return ((double) tan((x / 2.0)));
}




Bits error versus x
Results
| Original | 29.9 |
|---|---|
| Target | 0.0 |
| Herbie | 0.0 |
Initial program 29.9
Simplified0.0
Final simplification0.0
herbie shell --seed 2020219
(FPCore (x)
:name "tanhf (example 3.4)"
:precision binary64
:herbie-expected 2
:herbie-target
(tan (/ x 2.0))
(/ (- 1.0 (cos x)) (sin x)))