\frac{x \cdot \frac{\sin y}{y}}{z}\begin{array}{l}
\mathbf{if}\;z \le -9143070719594530171069555313882934804480 \lor \neg \left(z \le 1.385132396102934305433311993086749775457 \cdot 10^{108}\right):\\
\;\;\;\;\left(x \cdot \frac{\sin y}{y}\right) \cdot \frac{1}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\
\end{array}double f(double x, double y, double z) {
double r512905 = x;
double r512906 = y;
double r512907 = sin(r512906);
double r512908 = r512907 / r512906;
double r512909 = r512905 * r512908;
double r512910 = z;
double r512911 = r512909 / r512910;
return r512911;
}
double f(double x, double y, double z) {
double r512912 = z;
double r512913 = -9.14307071959453e+39;
bool r512914 = r512912 <= r512913;
double r512915 = 1.3851323961029343e+108;
bool r512916 = r512912 <= r512915;
double r512917 = !r512916;
bool r512918 = r512914 || r512917;
double r512919 = x;
double r512920 = y;
double r512921 = sin(r512920);
double r512922 = r512921 / r512920;
double r512923 = r512919 * r512922;
double r512924 = 1.0;
double r512925 = r512924 / r512912;
double r512926 = r512923 * r512925;
double r512927 = r512912 / r512922;
double r512928 = r512919 / r512927;
double r512929 = r512918 ? r512926 : r512928;
return r512929;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 2.7 |
|---|---|
| Target | 0.3 |
| Herbie | 0.5 |
if z < -9.14307071959453e+39 or 1.3851323961029343e+108 < z Initial program 0.1
rmApplied div-inv0.2
if -9.14307071959453e+39 < z < 1.3851323961029343e+108Initial program 4.5
rmApplied *-un-lft-identity4.5
rmApplied clear-num4.8
Simplified4.8
rmApplied *-un-lft-identity4.8
Applied times-frac1.1
Applied associate-/r*0.7
Simplified0.6
Final simplification0.5
herbie shell --seed 2020001
(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))