\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -147933744.31255263 \lor \neg \left(z \le 5673807207157.2168\right):\\
\;\;\;\;\cosh x \cdot \left(y \cdot \frac{1}{x \cdot z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z} \cdot \mathsf{fma}\left(e^{x}, \frac{1}{2}, \frac{\frac{1}{2}}{e^{x}}\right)}{x}\\
\end{array}double f(double x, double y, double z) {
double r485281 = x;
double r485282 = cosh(r485281);
double r485283 = y;
double r485284 = r485283 / r485281;
double r485285 = r485282 * r485284;
double r485286 = z;
double r485287 = r485285 / r485286;
return r485287;
}
double f(double x, double y, double z) {
double r485288 = z;
double r485289 = -147933744.31255263;
bool r485290 = r485288 <= r485289;
double r485291 = 5673807207157.217;
bool r485292 = r485288 <= r485291;
double r485293 = !r485292;
bool r485294 = r485290 || r485293;
double r485295 = x;
double r485296 = cosh(r485295);
double r485297 = y;
double r485298 = 1.0;
double r485299 = r485295 * r485288;
double r485300 = r485298 / r485299;
double r485301 = r485297 * r485300;
double r485302 = r485296 * r485301;
double r485303 = r485297 / r485288;
double r485304 = exp(r485295);
double r485305 = 0.5;
double r485306 = r485305 / r485304;
double r485307 = fma(r485304, r485305, r485306);
double r485308 = r485303 * r485307;
double r485309 = r485308 / r485295;
double r485310 = r485294 ? r485302 : r485309;
return r485310;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 7.9 |
|---|---|
| Target | 0.4 |
| Herbie | 0.4 |
if z < -147933744.31255263 or 5673807207157.217 < z Initial program 12.5
rmApplied *-un-lft-identity12.5
Applied times-frac12.5
Simplified12.5
Simplified0.3
rmApplied div-inv0.4
if -147933744.31255263 < z < 5673807207157.217Initial program 0.4
rmApplied *-un-lft-identity0.4
Applied times-frac0.4
Simplified0.4
Simplified18.4
Taylor expanded around inf 18.4
Simplified0.3
Final simplification0.4
herbie shell --seed 2020056 +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))