\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;z \leq -3.4387833264871806 \cdot 10^{+50}:\\
\;\;\;\;\frac{\frac{\sin y \cdot x}{y}}{z}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_0 := \frac{\sin y}{y}\\
\mathbf{if}\;z \leq 8.570453442873267 \cdot 10^{-33}:\\
\;\;\;\;\frac{x}{\frac{z}{t_0}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot t_0}{z}\\
\end{array}\\
\end{array}
(FPCore (x y z) :precision binary64 (/ (* x (/ (sin y) y)) z))
(FPCore (x y z)
:precision binary64
(if (<= z -3.4387833264871806e+50)
(/ (/ (* (sin y) x) y) z)
(let* ((t_0 (/ (sin y) y)))
(if (<= z 8.570453442873267e-33) (/ x (/ z t_0)) (/ (* x t_0) z)))))double code(double x, double y, double z) {
return (x * (sin(y) / y)) / z;
}
double code(double x, double y, double z) {
double tmp;
if (z <= -3.4387833264871806e+50) {
tmp = ((sin(y) * x) / y) / z;
} else {
double t_0 = sin(y) / y;
double tmp_1;
if (z <= 8.570453442873267e-33) {
tmp_1 = x / (z / t_0);
} else {
tmp_1 = (x * t_0) / z;
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 2.5 |
|---|---|
| Target | 0.3 |
| Herbie | 0.5 |
if z < -3.4387833264871806e50Initial program 0.1
Taylor expanded in x around 0 1.6
if -3.4387833264871806e50 < z < 8.57045344287326717e-33Initial program 4.8
Applied associate-/l*_binary640.2
if 8.57045344287326717e-33 < z Initial program 0.2
Final simplification0.5
herbie shell --seed 2022067
(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))