\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -3.383191592887115717553319195823324783134 \cdot 10^{-8} \lor \neg \left(z \le 3.03355591603155297168608427108120014315 \cdot 10^{-25}\right):\\
\;\;\;\;\frac{y \cdot \mathsf{fma}\left(e^{x}, \frac{1}{2}, \frac{\frac{1}{2}}{e^{x}}\right)}{x \cdot z}\\
\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 r420406 = x;
double r420407 = cosh(r420406);
double r420408 = y;
double r420409 = r420408 / r420406;
double r420410 = r420407 * r420409;
double r420411 = z;
double r420412 = r420410 / r420411;
return r420412;
}
double f(double x, double y, double z) {
double r420413 = z;
double r420414 = -3.383191592887116e-08;
bool r420415 = r420413 <= r420414;
double r420416 = 3.033555916031553e-25;
bool r420417 = r420413 <= r420416;
double r420418 = !r420417;
bool r420419 = r420415 || r420418;
double r420420 = y;
double r420421 = x;
double r420422 = exp(r420421);
double r420423 = 0.5;
double r420424 = r420423 / r420422;
double r420425 = fma(r420422, r420423, r420424);
double r420426 = r420420 * r420425;
double r420427 = r420421 * r420413;
double r420428 = r420426 / r420427;
double r420429 = r420420 / r420413;
double r420430 = r420429 * r420425;
double r420431 = r420430 / r420421;
double r420432 = r420419 ? r420428 : r420431;
return r420432;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 7.8 |
|---|---|
| Target | 0.5 |
| Herbie | 0.3 |
if z < -3.383191592887116e-08 or 3.033555916031553e-25 < z Initial program 11.4
Taylor expanded around inf 0.3
Simplified10.7
rmApplied associate-*r/10.6
rmApplied associate-*l/10.6
Applied associate-/l/0.3
if -3.383191592887116e-08 < z < 3.033555916031553e-25Initial program 0.3
Taylor expanded around inf 20.7
Simplified0.4
rmApplied associate-*r/0.3
Final simplification0.3
herbie shell --seed 2020002 +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))