\frac{\cosh x \cdot \frac{y}{x}}{z}
\begin{array}{l}
t_0 := \cosh x \cdot y\\
\mathbf{if}\;z \leq -5.365992924946917 \cdot 10^{-16}:\\
\;\;\;\;\frac{t_0}{z \cdot x}\\
\mathbf{elif}\;z \leq 149749414749544.78:\\
\;\;\;\;\frac{\frac{t_0}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{\frac{1}{z}}{x}\\
\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 (<= z -5.365992924946917e-16)
(/ t_0 (* z x))
(if (<= z 149749414749544.78) (/ (/ t_0 z) x) (* t_0 (/ (/ 1.0 z) x))))))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 (z <= -5.365992924946917e-16) {
tmp = t_0 / (z * x);
} else if (z <= 149749414749544.78) {
tmp = (t_0 / z) / x;
} else {
tmp = t_0 * ((1.0 / z) / x);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.7 |
|---|---|
| Target | 0.5 |
| Herbie | 0.3 |
if z < -5.36599292494691668e-16Initial program 11.3
Applied associate-*r/_binary6411.3
Applied associate-/l/_binary640.3
Applied div-inv_binary640.4
Applied associate-*r/_binary640.3
if -5.36599292494691668e-16 < z < 149749414749544.781Initial program 0.3
Applied associate-*r/_binary640.3
Applied associate-/l/_binary6419.3
Applied associate-/r*_binary640.3
if 149749414749544.781 < z Initial program 12.2
Applied associate-*r/_binary6412.2
Applied associate-/l/_binary640.3
Applied div-inv_binary640.4
Applied associate-/r*_binary640.4
Final simplification0.3
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))