\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;y \le -134764098203869446144 \lor \neg \left(y \le 1.481740486521299863421596595564379045588 \cdot 10^{-48}\right):\\
\;\;\;\;\frac{\frac{\left(e^{x} + e^{-x}\right) \cdot y}{z}}{2 \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\frac{1}{2} \cdot \left(e^{-1 \cdot x} + e^{x}\right)\right) \cdot \frac{y}{x}}{z}\\
\end{array}double f(double x, double y, double z) {
double r368429 = x;
double r368430 = cosh(r368429);
double r368431 = y;
double r368432 = r368431 / r368429;
double r368433 = r368430 * r368432;
double r368434 = z;
double r368435 = r368433 / r368434;
return r368435;
}
double f(double x, double y, double z) {
double r368436 = y;
double r368437 = -1.3476409820386945e+20;
bool r368438 = r368436 <= r368437;
double r368439 = 1.4817404865213e-48;
bool r368440 = r368436 <= r368439;
double r368441 = !r368440;
bool r368442 = r368438 || r368441;
double r368443 = x;
double r368444 = exp(r368443);
double r368445 = -r368443;
double r368446 = exp(r368445);
double r368447 = r368444 + r368446;
double r368448 = r368447 * r368436;
double r368449 = z;
double r368450 = r368448 / r368449;
double r368451 = 2.0;
double r368452 = r368451 * r368443;
double r368453 = r368450 / r368452;
double r368454 = 0.5;
double r368455 = -1.0;
double r368456 = r368455 * r368443;
double r368457 = exp(r368456);
double r368458 = r368457 + r368444;
double r368459 = r368454 * r368458;
double r368460 = r368436 / r368443;
double r368461 = r368459 * r368460;
double r368462 = r368461 / r368449;
double r368463 = r368442 ? r368453 : r368462;
return r368463;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.8 |
|---|---|
| Target | 0.5 |
| Herbie | 0.5 |
if y < -1.3476409820386945e+20Initial program 24.7
rmApplied cosh-def24.7
Applied frac-times24.7
Applied associate-/l/0.4
rmApplied associate-/r*0.4
rmApplied div-inv0.5
Applied times-frac0.5
if -1.3476409820386945e+20 < y < 1.4817404865213e-48Initial program 0.4
Taylor expanded around inf 0.4
Simplified0.4
if 1.4817404865213e-48 < y Initial program 16.9
rmApplied cosh-def17.0
Applied frac-times17.0
Applied associate-/l/0.7
rmApplied associate-/r*0.8
rmApplied div-inv0.9
Final simplification0.5
herbie shell --seed 2019294
(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.03853053593515302e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))
(/ (* (cosh x) (/ y x)) z))