\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;y \le -12403175825184520:\\
\;\;\;\;\frac{\frac{\cosh x}{\frac{z}{y}}}{x}\\
\mathbf{elif}\;y \le 4.70989780554481168 \cdot 10^{-7}:\\
\;\;\;\;\frac{\frac{\cosh x \cdot y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{x}{\frac{\cosh x \cdot y}{z}}}\\
\end{array}double f(double x, double y, double z) {
double r503787 = x;
double r503788 = cosh(r503787);
double r503789 = y;
double r503790 = r503789 / r503787;
double r503791 = r503788 * r503790;
double r503792 = z;
double r503793 = r503791 / r503792;
return r503793;
}
double f(double x, double y, double z) {
double r503794 = y;
double r503795 = -1.240317582518452e+16;
bool r503796 = r503794 <= r503795;
double r503797 = x;
double r503798 = cosh(r503797);
double r503799 = z;
double r503800 = r503799 / r503794;
double r503801 = r503798 / r503800;
double r503802 = r503801 / r503797;
double r503803 = 4.7098978055448117e-07;
bool r503804 = r503794 <= r503803;
double r503805 = r503798 * r503794;
double r503806 = r503805 / r503797;
double r503807 = r503806 / r503799;
double r503808 = 1.0;
double r503809 = r503805 / r503799;
double r503810 = r503797 / r503809;
double r503811 = r503808 / r503810;
double r503812 = r503804 ? r503807 : r503811;
double r503813 = r503796 ? r503802 : r503812;
return r503813;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.3 |
|---|---|
| Target | 0.5 |
| Herbie | 0.3 |
if y < -1.240317582518452e+16Initial program 22.3
rmApplied associate-*r/22.3
Applied associate-/l/0.3
rmApplied associate-/r*0.3
rmApplied associate-/l*0.4
if -1.240317582518452e+16 < y < 4.7098978055448117e-07Initial program 0.3
rmApplied associate-*r/0.3
Applied associate-/l/11.1
rmApplied associate-/r*10.3
rmApplied clear-num10.4
rmApplied associate-/r/0.7
Applied associate-/r*0.3
Simplified0.3
if 4.7098978055448117e-07 < y Initial program 20.3
rmApplied associate-*r/20.4
Applied associate-/l/0.5
rmApplied associate-/r*0.5
rmApplied clear-num0.6
Final simplification0.3
herbie shell --seed 2020064 +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))