\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
t_0 := x \cdot \frac{\sin y}{y}\\
\mathbf{if}\;t_0 \leq -1.0897289187131854 \cdot 10^{-154}:\\
\;\;\;\;\frac{t_0}{z}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := \frac{y}{\sin y}\\
\mathbf{if}\;t_0 \leq 3.588673077855241 \cdot 10^{-233}:\\
\;\;\;\;\frac{\frac{x}{z}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t_1}}{z}\\
\end{array}\\
\end{array}
(FPCore (x y z) :precision binary64 (/ (* x (/ (sin y) y)) z))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (/ (sin y) y))))
(if (<= t_0 -1.0897289187131854e-154)
(/ t_0 z)
(let* ((t_1 (/ y (sin y))))
(if (<= t_0 3.588673077855241e-233) (/ (/ x z) t_1) (/ (/ x t_1) z))))))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 = x * (sin(y) / y);
double tmp;
if (t_0 <= -1.0897289187131854e-154) {
tmp = t_0 / z;
} else {
double t_1 = y / sin(y);
double tmp_1;
if (t_0 <= 3.588673077855241e-233) {
tmp_1 = (x / z) / t_1;
} else {
tmp_1 = (x / t_1) / z;
}
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 (*.f64 x (/.f64 (sin.f64 y) y)) < -1.08972891871318537e-154Initial program 0.2
if -1.08972891871318537e-154 < (*.f64 x (/.f64 (sin.f64 y) y)) < 3.588673077855241e-233Initial program 7.8
Applied clear-num_binary647.8
Applied un-div-inv_binary647.8
Applied associate-/l/_binary640.5
Applied associate-/r*_binary640.4
if 3.588673077855241e-233 < (*.f64 x (/.f64 (sin.f64 y) y)) Initial program 0.2
Applied clear-num_binary640.2
Applied un-div-inv_binary640.2
Final simplification0.3
herbie shell --seed 2022081
(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))