\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;y \leq -3.6887628113558124 \cdot 10^{-38} \lor \neg \left(y \leq 5.543226388400742 \cdot 10^{-34}\right):\\
\;\;\;\;\cosh x \cdot \frac{y}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(e^{x} + e^{-x}\right) \cdot \frac{y}{x}}{z \cdot 2}\\
\end{array}(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
(FPCore (x y z) :precision binary64 (if (or (<= y -3.6887628113558124e-38) (not (<= y 5.543226388400742e-34))) (* (cosh x) (/ y (* x z))) (/ (* (+ (exp x) (exp (- x))) (/ y x)) (* z 2.0))))
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 (((y <= -3.6887628113558124e-38) || !(y <= 5.543226388400742e-34))) {
tmp = ((double) (((double) cosh(x)) * (y / ((double) (x * z)))));
} else {
tmp = (((double) (((double) (((double) exp(x)) + ((double) exp(((double) -(x)))))) * (y / x))) / ((double) (z * 2.0)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.9 |
|---|---|
| Target | 0.4 |
| Herbie | 0.3 |
if y < -3.6887628113558124e-38 or 5.5432263884007423e-34 < y Initial program Error: 18.4 bits
SimplifiedError: 0.4 bits
if -3.6887628113558124e-38 < y < 5.5432263884007423e-34Initial program Error: 0.2 bits
rmApplied cosh-defError: 0.2 bits
Applied associate-*l/Error: 0.2 bits
Applied associate-/l/Error: 0.2 bits
Final simplificationError: 0.3 bits
herbie shell --seed 2020203
(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))