\frac{\cosh x \cdot \frac{y}{x}}{z}
\begin{array}{l}
t_0 := \cosh x \cdot y\\
\mathbf{if}\;\cosh x \cdot \frac{y}{x} \leq -\infty:\\
\;\;\;\;\frac{\frac{t_0}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_0}{x}}{z}\\
\end{array}
(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (cosh x) y)))
(if (<= (* (cosh x) (/ y x)) (- INFINITY))
(/ (/ t_0 z) x)
(/ (/ t_0 x) z))))double code(double x, double y, double z) {
return (cosh(x) * (y / x)) / z;
}
double code(double x, double y, double z) {
double t_0 = cosh(x) * y;
double tmp;
if ((cosh(x) * (y / x)) <= -((double) INFINITY)) {
tmp = (t_0 / z) / x;
} else {
tmp = (t_0 / x) / z;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 9.4 |
|---|---|
| Target | 1.8 |
| Herbie | 1.2 |
if (*.f64 (cosh.f64 x) (/.f64 y x)) < -inf.0Initial program 4.7
Applied div-inv_binary644.7
Applied associate-*r/_binary644.7
Applied associate-*l/_binary640.0
Simplified0.0
if -inf.0 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 10.9
Applied associate-*r/_binary641.6
Final simplification1.2
herbie shell --seed 2022068
(FPCore (x y z)
:name "Linear.Quaternion:$ctan from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< y -4.618902267687042e-52) (* (/ (/ y z) x) (cosh x)) (if (< y 1.038530535935153e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))
(/ (* (cosh x) (/ y x)) z))