\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;y \le -19.7335978520876729:\\
\;\;\;\;\cosh x \cdot \frac{y}{x \cdot z}\\
\mathbf{elif}\;y \le 7876022.030429827:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{2}, \frac{x \cdot y}{z}, \frac{\frac{y}{x}}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(e^{x} + e^{-x}\right) \cdot \frac{y}{z}}{2 \cdot x}\\
\end{array}double f(double x, double y, double z) {
double r658475 = x;
double r658476 = cosh(r658475);
double r658477 = y;
double r658478 = r658477 / r658475;
double r658479 = r658476 * r658478;
double r658480 = z;
double r658481 = r658479 / r658480;
return r658481;
}
double f(double x, double y, double z) {
double r658482 = y;
double r658483 = -19.733597852087673;
bool r658484 = r658482 <= r658483;
double r658485 = x;
double r658486 = cosh(r658485);
double r658487 = z;
double r658488 = r658485 * r658487;
double r658489 = r658482 / r658488;
double r658490 = r658486 * r658489;
double r658491 = 7876022.030429827;
bool r658492 = r658482 <= r658491;
double r658493 = 0.5;
double r658494 = r658485 * r658482;
double r658495 = r658494 / r658487;
double r658496 = r658482 / r658485;
double r658497 = r658496 / r658487;
double r658498 = fma(r658493, r658495, r658497);
double r658499 = exp(r658485);
double r658500 = -r658485;
double r658501 = exp(r658500);
double r658502 = r658499 + r658501;
double r658503 = r658482 / r658487;
double r658504 = r658502 * r658503;
double r658505 = 2.0;
double r658506 = r658505 * r658485;
double r658507 = r658504 / r658506;
double r658508 = r658492 ? r658498 : r658507;
double r658509 = r658484 ? r658490 : r658508;
return r658509;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 7.8 |
|---|---|
| Target | 0.4 |
| Herbie | 0.7 |
if y < -19.733597852087673Initial program 20.7
rmApplied *-un-lft-identity20.7
Applied times-frac20.7
Simplified20.7
Simplified0.2
if -19.733597852087673 < y < 7876022.030429827Initial program 0.3
Taylor expanded around 0 11.2
Simplified0.9
if 7876022.030429827 < y Initial program 22.1
rmApplied *-un-lft-identity22.1
Applied times-frac21.9
Simplified21.9
Simplified0.3
rmApplied *-un-lft-identity0.3
Applied times-frac0.3
rmApplied associate-*l/0.3
Applied cosh-def0.3
Applied frac-times0.3
Simplified0.3
Final simplification0.7
herbie shell --seed 2020043 +o rules:numerics
(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))