\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
t_0 := \frac{\sin y}{y}\\
\mathbf{if}\;z \leq -2.8388904751584647 \cdot 10^{-127}:\\
\;\;\;\;\frac{x \cdot t_0}{z}\\
\mathbf{elif}\;z \leq 2.0504899839305107 \cdot 10^{-17}:\\
\;\;\;\;\frac{x}{\frac{z}{t_0}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{y}{\sin y}}\\
\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 (<= z -2.8388904751584647e-127)
(/ (* x t_0) z)
(if (<= z 2.0504899839305107e-17)
(/ x (/ z t_0))
(/ (/ x z) (/ y (sin y)))))))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 <= -2.8388904751584647e-127) {
tmp = (x * t_0) / z;
} else if (z <= 2.0504899839305107e-17) {
tmp = x / (z / t_0);
} else {
tmp = (x / z) / (y / sin(y));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 2.7 |
|---|---|
| Target | 0.3 |
| Herbie | 0.4 |
if z < -2.83889047515846475e-127Initial program 0.9
if -2.83889047515846475e-127 < z < 2.0504899839305107e-17Initial program 6.9
Applied associate-/l*_binary640.2
if 2.0504899839305107e-17 < z Initial program 0.1
Applied associate-/l*_binary645.1
Applied div-inv_binary645.1
Applied associate-/r*_binary640.1
Taylor expanded in y around inf 0.1
Final simplification0.4
herbie shell --seed 2021313
(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))