\frac{1 - \cos x}{\sin x}\begin{array}{l}
\mathbf{if}\;x \le -0.02421991371580364468818480361278488999233 \lor \neg \left(x \le 0.02129980552074291558217744579906138824299\right):\\
\;\;\;\;\frac{\frac{1 \cdot 1 + \left(\cos x \cdot \cos x + 1 \cdot \cos x\right)}{1}}{\frac{\sin x}{\frac{1 - \cos x}{\cos x \cdot \left(\cos x + 1\right) + 1 \cdot 1}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{24} \cdot {x}^{3} + \left(\frac{1}{240} \cdot {x}^{5} + \frac{1}{2} \cdot x\right)\\
\end{array}double f(double x) {
double r65795 = 1.0;
double r65796 = x;
double r65797 = cos(r65796);
double r65798 = r65795 - r65797;
double r65799 = sin(r65796);
double r65800 = r65798 / r65799;
return r65800;
}
double f(double x) {
double r65801 = x;
double r65802 = -0.024219913715803645;
bool r65803 = r65801 <= r65802;
double r65804 = 0.021299805520742916;
bool r65805 = r65801 <= r65804;
double r65806 = !r65805;
bool r65807 = r65803 || r65806;
double r65808 = 1.0;
double r65809 = r65808 * r65808;
double r65810 = cos(r65801);
double r65811 = r65810 * r65810;
double r65812 = r65808 * r65810;
double r65813 = r65811 + r65812;
double r65814 = r65809 + r65813;
double r65815 = 1.0;
double r65816 = r65814 / r65815;
double r65817 = sin(r65801);
double r65818 = r65808 - r65810;
double r65819 = r65810 + r65808;
double r65820 = r65810 * r65819;
double r65821 = r65820 + r65809;
double r65822 = r65818 / r65821;
double r65823 = r65817 / r65822;
double r65824 = r65816 / r65823;
double r65825 = 0.041666666666666664;
double r65826 = 3.0;
double r65827 = pow(r65801, r65826);
double r65828 = r65825 * r65827;
double r65829 = 0.004166666666666667;
double r65830 = 5.0;
double r65831 = pow(r65801, r65830);
double r65832 = r65829 * r65831;
double r65833 = 0.5;
double r65834 = r65833 * r65801;
double r65835 = r65832 + r65834;
double r65836 = r65828 + r65835;
double r65837 = r65807 ? r65824 : r65836;
return r65837;
}




Bits error versus x
Results
| Original | 30.3 |
|---|---|
| Target | 0.0 |
| Herbie | 0.5 |
if x < -0.024219913715803645 or 0.021299805520742916 < x Initial program 0.9
rmApplied flip3--1.0
Simplified1.0
rmApplied *-un-lft-identity1.0
Applied difference-cubes1.0
Applied times-frac1.0
Applied associate-/l*1.0
if -0.024219913715803645 < x < 0.021299805520742916Initial program 59.8
Taylor expanded around 0 0.0
Final simplification0.5
herbie shell --seed 2019362
(FPCore (x)
:name "tanhf (example 3.4)"
:precision binary64
:herbie-expected 2
:herbie-target
(tan (/ x 2))
(/ (- 1 (cos x)) (sin x)))