\frac{x \cdot \frac{\sin y}{y}}{z}\begin{array}{l}
\mathbf{if}\;z \le -3.3341519654404754 \cdot 10^{-26} \lor \neg \left(z \le 20427325237287192\right):\\
\;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\left(-z\right) \cdot \frac{y}{\sin y}}\\
\end{array}double f(double x, double y, double z) {
double r432871 = x;
double r432872 = y;
double r432873 = sin(r432872);
double r432874 = r432873 / r432872;
double r432875 = r432871 * r432874;
double r432876 = z;
double r432877 = r432875 / r432876;
return r432877;
}
double f(double x, double y, double z) {
double r432878 = z;
double r432879 = -3.3341519654404754e-26;
bool r432880 = r432878 <= r432879;
double r432881 = 2.042732523728719e+16;
bool r432882 = r432878 <= r432881;
double r432883 = !r432882;
bool r432884 = r432880 || r432883;
double r432885 = x;
double r432886 = y;
double r432887 = sin(r432886);
double r432888 = r432887 / r432886;
double r432889 = r432885 * r432888;
double r432890 = r432889 / r432878;
double r432891 = -r432885;
double r432892 = -r432878;
double r432893 = r432886 / r432887;
double r432894 = r432892 * r432893;
double r432895 = r432891 / r432894;
double r432896 = r432884 ? r432890 : r432895;
return r432896;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 2.7 |
|---|---|
| Target | 0.3 |
| Herbie | 0.2 |
if z < -3.3341519654404754e-26 or 2.042732523728719e+16 < z Initial program 0.1
if -3.3341519654404754e-26 < z < 2.042732523728719e+16Initial program 5.9
rmApplied clear-num6.0
rmApplied frac-2neg6.0
Simplified5.9
rmApplied associate-/l/0.2
Final simplification0.2
herbie shell --seed 2020036 +o rules:numerics
(FPCore (x y z)
:name "Linear.Quaternion:$ctanh from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< z -4.2173720203427147e-29) (/ (* x (/ 1 (/ y (sin y)))) z) (if (< z 4.446702369113811e+64) (/ x (* z (/ y (sin y)))) (/ (* x (/ 1 (/ y (sin y)))) z)))
(/ (* x (/ (sin y) y)) z))