\frac{x \cdot \frac{\sin y}{y}}{z}\begin{array}{l}
\mathbf{if}\;z \le -7.37385740450310983 \cdot 10^{23}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{\sin y}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z \cdot \frac{y}{\sin y}}\\
\end{array}double f(double x, double y, double z) {
double r82982 = x;
double r82983 = y;
double r82984 = sin(r82983);
double r82985 = r82984 / r82983;
double r82986 = r82982 * r82985;
double r82987 = z;
double r82988 = r82986 / r82987;
return r82988;
}
double f(double x, double y, double z) {
double r82989 = z;
double r82990 = -7.37385740450311e+23;
bool r82991 = r82989 <= r82990;
double r82992 = x;
double r82993 = r82992 / r82989;
double r82994 = y;
double r82995 = sin(r82994);
double r82996 = r82995 / r82994;
double r82997 = r82993 * r82996;
double r82998 = r82994 / r82995;
double r82999 = r82989 * r82998;
double r83000 = r82992 / r82999;
double r83001 = r82991 ? r82997 : r83000;
return r83001;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 2.9 |
|---|---|
| Target | 0.3 |
| Herbie | 1.5 |
if z < -7.37385740450311e+23Initial program 0.1
rmApplied associate-/l*5.5
rmApplied associate-/r/0.1
if -7.37385740450311e+23 < z Initial program 3.8
rmApplied associate-/l*1.9
rmApplied associate-/r/3.8
rmApplied clear-num3.8
rmApplied frac-times2.0
Simplified2.0
Final simplification1.5
herbie shell --seed 2020045 +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))