\frac{1 - \cos x}{\sin x}\tan \left(\frac{x}{2}\right)double f(double x) {
double r77401 = 1.0;
double r77402 = x;
double r77403 = cos(r77402);
double r77404 = r77401 - r77403;
double r77405 = sin(r77402);
double r77406 = r77404 / r77405;
return r77406;
}
double f(double x) {
double r77407 = x;
double r77408 = 2.0;
double r77409 = r77407 / r77408;
double r77410 = tan(r77409);
return r77410;
}




Bits error versus x
Results
| Original | 30.2 |
|---|---|
| Target | 0.0 |
| Herbie | 0.0 |
Initial program 30.2
rmApplied add-exp-log30.2
rmApplied log1p-expm1-u30.2
Taylor expanded around inf 30.2
rmApplied hang-p0-tan0.0
Final simplification0.0
herbie shell --seed 2019198 +o rules:numerics
(FPCore (x)
:name "tanhf (example 3.4)"
:herbie-expected 2
:herbie-target
(tan (/ x 2.0))
(/ (- 1.0 (cos x)) (sin x)))