\frac{x \cdot \frac{\sin y}{y}}{z}\begin{array}{l}
\mathbf{if}\;z \le -1.087165816385635344943339840209275513753 \cdot 10^{-13} \lor \neg \left(z \le 9.627811326025673289997350667394252252108 \cdot 10^{-38}\right):\\
\;\;\;\;\frac{\sin y}{y} \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\sin y}{z}}{y} \cdot x\\
\end{array}double f(double x, double y, double z) {
double r445900 = x;
double r445901 = y;
double r445902 = sin(r445901);
double r445903 = r445902 / r445901;
double r445904 = r445900 * r445903;
double r445905 = z;
double r445906 = r445904 / r445905;
return r445906;
}
double f(double x, double y, double z) {
double r445907 = z;
double r445908 = -1.0871658163856353e-13;
bool r445909 = r445907 <= r445908;
double r445910 = 9.627811326025673e-38;
bool r445911 = r445907 <= r445910;
double r445912 = !r445911;
bool r445913 = r445909 || r445912;
double r445914 = y;
double r445915 = sin(r445914);
double r445916 = r445915 / r445914;
double r445917 = x;
double r445918 = r445917 / r445907;
double r445919 = r445916 * r445918;
double r445920 = r445915 / r445907;
double r445921 = r445920 / r445914;
double r445922 = r445921 * r445917;
double r445923 = r445913 ? r445919 : r445922;
return r445923;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 2.6 |
|---|---|
| Target | 0.3 |
| Herbie | 0.3 |
if z < -1.0871658163856353e-13 or 9.627811326025673e-38 < z Initial program 0.2
Simplified4.3
Taylor expanded around inf 7.6
Simplified0.2
if -1.0871658163856353e-13 < z < 9.627811326025673e-38Initial program 5.9
Simplified0.3
rmApplied *-un-lft-identity0.3
Applied *-un-lft-identity0.3
Applied *-un-lft-identity0.3
Applied times-frac0.3
Applied times-frac0.3
Simplified0.3
Simplified0.4
Final simplification0.3
herbie shell --seed 2019194 +o rules:numerics
(FPCore (x y z)
:name "Linear.Quaternion:$ctanh from linear-1.19.1.3"
:herbie-target
(if (< z -4.2173720203427147e-29) (/ (* x (/ 1.0 (/ y (sin y)))) z) (if (< z 4.446702369113811e+64) (/ x (* z (/ y (sin y)))) (/ (* x (/ 1.0 (/ y (sin y)))) z)))
(/ (* x (/ (sin y) y)) z))