\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
t_0 := \frac{\sin y}{y}\\
\mathbf{if}\;z \leq -4.8283065942761595 \cdot 10^{-37} \lor \neg \left(z \leq 1.6550925650564505 \cdot 10^{+71}\right):\\
\;\;\;\;\frac{x}{z} \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t_0}}\\
\end{array}
(FPCore (x y z) :precision binary64 (/ (* x (/ (sin y) y)) z))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (sin y) y)))
(if (or (<= z -4.8283065942761595e-37) (not (<= z 1.6550925650564505e+71)))
(* (/ x z) t_0)
(/ x (/ z t_0)))))double code(double x, double y, double z) {
return (x * (sin(y) / y)) / z;
}
double code(double x, double y, double z) {
double t_0 = sin(y) / y;
double tmp;
if ((z <= -4.8283065942761595e-37) || !(z <= 1.6550925650564505e+71)) {
tmp = (x / z) * t_0;
} else {
tmp = x / (z / t_0);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 2.6 |
|---|---|
| Target | 0.2 |
| Herbie | 0.3 |
if z < -4.8283065942761595e-37 or 1.65509256505645052e71 < z Initial program 0.1
Applied associate-/l*_binary645.5
Applied associate-/r/_binary640.2
if -4.8283065942761595e-37 < z < 1.65509256505645052e71Initial program 5.1
Applied associate-/l*_binary640.4
Final simplification0.3
herbie shell --seed 2021280
(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.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))