\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;\cosh x \cdot \frac{y}{x} \leq -5.8237894250236384 \cdot 10^{+256} \lor \neg \left(\cosh x \cdot \frac{y}{x} \leq 7.777588006988912 \cdot 10^{+175}\right):\\
\;\;\;\;\frac{\frac{y \cdot \left(e^{x} + e^{-x}\right)}{z}}{x \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\left(\cosh x \cdot \frac{y}{x}\right) \cdot \frac{1}{z}\\
\end{array}(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
(FPCore (x y z)
:precision binary64
(if (or (<= (* (cosh x) (/ y x)) -5.8237894250236384e+256)
(not (<= (* (cosh x) (/ y x)) 7.777588006988912e+175)))
(/ (/ (* y (+ (exp x) (exp (- x)))) z) (* x 2.0))
(* (* (cosh x) (/ y x)) (/ 1.0 z))))double code(double x, double y, double z) {
return (((double) (((double) cosh(x)) * (y / x))) / z);
}
double code(double x, double y, double z) {
double tmp;
if (((((double) (((double) cosh(x)) * (y / x))) <= -5.8237894250236384e+256) || !(((double) (((double) cosh(x)) * (y / x))) <= 7.777588006988912e+175))) {
tmp = ((((double) (y * ((double) (((double) exp(x)) + ((double) exp(((double) -(x)))))))) / z) / ((double) (x * 2.0)));
} else {
tmp = ((double) (((double) (((double) cosh(x)) * (y / x))) * (1.0 / z)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.6 |
|---|---|
| Target | 0.4 |
| Herbie | 0.5 |
if (* (cosh x) (/ y x)) < -5.82378942502363837e256 or 7.77758800698891167e175 < (* (cosh x) (/ y x)) Initial program Error: 30.9 bits
rmApplied cosh-defError: 30.9 bits
Applied frac-timesError: 30.9 bits
Applied associate-/l/Error: 1.1 bits
SimplifiedError: 1.1 bits
rmApplied add-sqr-sqrtError: 2.0 bits
Applied associate-*l*Error: 1.7 bits
SimplifiedError: 1.7 bits
rmApplied associate-/r*Error: 1.7 bits
SimplifiedError: 1.1 bits
if -5.82378942502363837e256 < (* (cosh x) (/ y x)) < 7.77758800698891167e175Initial program Error: 0.2 bits
rmApplied div-invError: 0.3 bits
Final simplificationError: 0.5 bits
herbie shell --seed 2020205
(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.0385305359351529e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))
(/ (* (cosh x) (/ y x)) z))