\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;z \leq -2.6572955623815812 \cdot 10^{-51}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{1}{\frac{\sin y}{y}}}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_0 := \frac{y}{\sin y}\\
\mathbf{if}\;z \leq 1.0432202070371389 \cdot 10^{-17}:\\
\;\;\;\;\frac{x}{z \cdot t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{x}{t_0}\\
\end{array}\\
\end{array}
(FPCore (x y z) :precision binary64 (/ (* x (/ (sin y) y)) z))
(FPCore (x y z)
:precision binary64
(if (<= z -2.6572955623815812e-51)
(/ (/ x z) (/ 1.0 (/ (sin y) y)))
(let* ((t_0 (/ y (sin y))))
(if (<= z 1.0432202070371389e-17)
(/ x (* z t_0))
(* (/ 1.0 z) (/ x 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 tmp;
if (z <= -2.6572955623815812e-51) {
tmp = (x / z) / (1.0 / (sin(y) / y));
} else {
double t_0 = y / sin(y);
double tmp_1;
if (z <= 1.0432202070371389e-17) {
tmp_1 = x / (z * t_0);
} else {
tmp_1 = (1.0 / z) * (x / t_0);
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 2.8 |
|---|---|
| Target | 0.3 |
| Herbie | 0.3 |
if z < -2.65729556238158123e-51Initial program 0.2
Applied associate-/l*_binary644.9
Applied div-inv_binary644.9
Applied associate-/r*_binary640.3
if -2.65729556238158123e-51 < z < 1.0432202070371389e-17Initial program 6.7
Applied associate-/l*_binary640.2
Applied div-inv_binary640.3
Simplified0.3
if 1.0432202070371389e-17 < z Initial program 0.1
Applied associate-/l*_binary645.2
Applied div-inv_binary645.2
Simplified5.2
Applied *-un-lft-identity_binary645.2
Applied times-frac_binary640.2
Final simplification0.3
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))