\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -1.025967367497455730113268706012740099348 \cdot 10^{54} \lor \neg \left(z \le 3.298414950520773924444494287766538320739 \cdot 10^{-6}\right):\\
\;\;\;\;\frac{\cosh x \cdot y}{\frac{x}{\frac{1}{z}}}\\
\mathbf{else}:\\
\;\;\;\;\cosh x \cdot \frac{\frac{y}{z}}{x}\\
\end{array}double f(double x, double y, double z) {
double r324633 = x;
double r324634 = cosh(r324633);
double r324635 = y;
double r324636 = r324635 / r324633;
double r324637 = r324634 * r324636;
double r324638 = z;
double r324639 = r324637 / r324638;
return r324639;
}
double f(double x, double y, double z) {
double r324640 = z;
double r324641 = -1.0259673674974557e+54;
bool r324642 = r324640 <= r324641;
double r324643 = 3.298414950520774e-06;
bool r324644 = r324640 <= r324643;
double r324645 = !r324644;
bool r324646 = r324642 || r324645;
double r324647 = x;
double r324648 = cosh(r324647);
double r324649 = y;
double r324650 = r324648 * r324649;
double r324651 = 1.0;
double r324652 = r324651 / r324640;
double r324653 = r324647 / r324652;
double r324654 = r324650 / r324653;
double r324655 = r324649 / r324640;
double r324656 = r324655 / r324647;
double r324657 = r324648 * r324656;
double r324658 = r324646 ? r324654 : r324657;
return r324658;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.7 |
|---|---|
| Target | 0.5 |
| Herbie | 0.5 |
if z < -1.0259673674974557e+54 or 3.298414950520774e-06 < z Initial program 12.2
rmApplied associate-/l*12.6
Simplified10.7
rmApplied div-inv10.8
Applied *-un-lft-identity10.8
Applied times-frac0.9
Applied associate-/r*0.5
Simplified0.5
if -1.0259673674974557e+54 < z < 3.298414950520774e-06Initial program 0.6
rmApplied associate-/l*0.7
Simplified0.6
rmApplied div-inv0.6
Simplified0.5
Final simplification0.5
herbie shell --seed 2019322 +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.038530535935153e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))
(/ (* (cosh x) (/ y x)) z))