\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 r58782 = x;
double r58783 = y;
double r58784 = sin(r58783);
double r58785 = r58784 / r58783;
double r58786 = r58782 * r58785;
double r58787 = z;
double r58788 = r58786 / r58787;
return r58788;
}
double f(double x, double y, double z) {
double r58789 = z;
double r58790 = -7.37385740450311e+23;
bool r58791 = r58789 <= r58790;
double r58792 = x;
double r58793 = r58792 / r58789;
double r58794 = y;
double r58795 = sin(r58794);
double r58796 = r58795 / r58794;
double r58797 = r58793 * r58796;
double r58798 = r58794 / r58795;
double r58799 = r58789 * r58798;
double r58800 = r58792 / r58799;
double r58801 = r58791 ? r58797 : r58800;
return r58801;
}




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))