\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;y \le -280311605560231821312:\\
\;\;\;\;\frac{\frac{y}{2 \cdot z} \cdot \frac{{\left(e^{x}\right)}^{3} + {\left(e^{-x}\right)}^{3}}{\mathsf{fma}\left(e^{x}, e^{x}, {\left(e^{-x}\right)}^{2} - 1\right)}}{x}\\
\mathbf{elif}\;y \le 5.764064057561761129309028881747428957517 \cdot 10^{-61}:\\
\;\;\;\;\frac{\left(y \cdot \cosh x\right) \cdot \frac{1}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{2} \cdot \left(e^{x} + e^{-x}\right)}{x} \cdot \frac{y}{z}\\
\end{array}double f(double x, double y, double z) {
double r302795 = x;
double r302796 = cosh(r302795);
double r302797 = y;
double r302798 = r302797 / r302795;
double r302799 = r302796 * r302798;
double r302800 = z;
double r302801 = r302799 / r302800;
return r302801;
}
double f(double x, double y, double z) {
double r302802 = y;
double r302803 = -2.8031160556023182e+20;
bool r302804 = r302802 <= r302803;
double r302805 = 2.0;
double r302806 = z;
double r302807 = r302805 * r302806;
double r302808 = r302802 / r302807;
double r302809 = x;
double r302810 = exp(r302809);
double r302811 = 3.0;
double r302812 = pow(r302810, r302811);
double r302813 = -r302809;
double r302814 = exp(r302813);
double r302815 = pow(r302814, r302811);
double r302816 = r302812 + r302815;
double r302817 = pow(r302814, r302805);
double r302818 = 1.0;
double r302819 = r302817 - r302818;
double r302820 = fma(r302810, r302810, r302819);
double r302821 = r302816 / r302820;
double r302822 = r302808 * r302821;
double r302823 = r302822 / r302809;
double r302824 = 5.764064057561761e-61;
bool r302825 = r302802 <= r302824;
double r302826 = cosh(r302809);
double r302827 = r302802 * r302826;
double r302828 = r302818 / r302809;
double r302829 = r302827 * r302828;
double r302830 = r302829 / r302806;
double r302831 = 0.5;
double r302832 = r302810 + r302814;
double r302833 = r302831 * r302832;
double r302834 = r302833 / r302809;
double r302835 = r302802 / r302806;
double r302836 = r302834 * r302835;
double r302837 = r302825 ? r302830 : r302836;
double r302838 = r302804 ? r302823 : r302837;
return r302838;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 8.0 |
|---|---|
| Target | 0.5 |
| Herbie | 0.6 |
if y < -2.8031160556023182e+20Initial program 23.4
rmApplied cosh-def23.4
Applied frac-times23.4
Applied associate-/l/0.4
Simplified0.5
rmApplied flip3-+0.6
Applied associate-*l/0.6
Simplified0.6
rmApplied associate-/r*0.6
Simplified0.5
if -2.8031160556023182e+20 < y < 5.764064057561761e-61Initial program 0.4
rmApplied div-inv0.5
Applied associate-*r*0.5
if 5.764064057561761e-61 < y Initial program 16.7
rmApplied cosh-def16.7
Applied frac-times16.7
Applied associate-/l/0.9
Simplified0.9
rmApplied div-inv1.2
Simplified1.1
Taylor expanded around inf 0.9
Simplified1.0
Final simplification0.6
herbie shell --seed 2019174 +o rules:numerics
(FPCore (x y z)
:name "Linear.Quaternion:$ctan from linear-1.19.1.3"
:herbie-target
(if (< y -4.618902267687042e-52) (* (/ (/ y z) x) (cosh x)) (if (< y 1.038530535935153e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))
(/ (* (cosh x) (/ y x)) z))