\frac{x \cdot \frac{\sin y}{y}}{z}\begin{array}{l}
\mathbf{if}\;z \le -5.35421204550298263 \cdot 10^{-138} \lor \neg \left(z \le 1.21824188071821231 \cdot 10^{-60}\right):\\
\;\;\;\;\frac{\sin y}{y} \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\frac{y}{\sin y} \cdot \left(-z\right)}\\
\end{array}double code(double x, double y, double z) {
return ((x * (sin(y) / y)) / z);
}
double code(double x, double y, double z) {
double VAR;
if (((z <= -5.3542120455029826e-138) || !(z <= 1.2182418807182123e-60))) {
VAR = ((sin(y) / y) * (x / z));
} else {
VAR = (-x / ((y / sin(y)) * -z));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 2.8 |
|---|---|
| Target | 0.3 |
| Herbie | 0.6 |
if z < -5.3542120455029826e-138 or 1.2182418807182123e-60 < z Initial program 0.7
rmApplied *-commutative0.7
Applied associate-/l*1.0
rmApplied div-inv1.1
Simplified0.8
if -5.3542120455029826e-138 < z < 1.2182418807182123e-60Initial program 8.1
rmApplied *-commutative8.1
Applied associate-/l*7.9
rmApplied div-inv8.5
Simplified8.3
rmApplied frac-2neg8.3
Applied clear-num8.4
Applied frac-times0.2
Simplified0.2
Final simplification0.6
herbie shell --seed 2020078
(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))