\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -1.72160496452561263986704681669141916127 \cdot 10^{202} \lor \neg \left(z \le 1.342227135368572564573491428767395770614 \cdot 10^{-58}\right):\\
\;\;\;\;\frac{y}{x \cdot z} \cdot \cosh x\\
\mathbf{else}:\\
\;\;\;\;\cosh x \cdot \frac{\frac{y}{z}}{x}\\
\end{array}double f(double x, double y, double z) {
double r406299 = x;
double r406300 = cosh(r406299);
double r406301 = y;
double r406302 = r406301 / r406299;
double r406303 = r406300 * r406302;
double r406304 = z;
double r406305 = r406303 / r406304;
return r406305;
}
double f(double x, double y, double z) {
double r406306 = z;
double r406307 = -1.7216049645256126e+202;
bool r406308 = r406306 <= r406307;
double r406309 = 1.3422271353685726e-58;
bool r406310 = r406306 <= r406309;
double r406311 = !r406310;
bool r406312 = r406308 || r406311;
double r406313 = y;
double r406314 = x;
double r406315 = r406314 * r406306;
double r406316 = r406313 / r406315;
double r406317 = cosh(r406314);
double r406318 = r406316 * r406317;
double r406319 = r406313 / r406306;
double r406320 = r406319 / r406314;
double r406321 = r406317 * r406320;
double r406322 = r406312 ? r406318 : r406321;
return r406322;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.6 |
|---|---|
| Target | 0.4 |
| Herbie | 2.1 |
if z < -1.7216049645256126e+202 or 1.3422271353685726e-58 < z Initial program 11.7
rmApplied associate-/l*12.2
Simplified10.8
rmApplied div-inv10.8
Simplified10.7
rmApplied *-un-lft-identity10.7
Applied *-un-lft-identity10.7
Applied *-un-lft-identity10.7
Applied times-frac10.7
Applied times-frac10.7
Simplified10.7
Simplified0.5
if -1.7216049645256126e+202 < z < 1.3422271353685726e-58Initial program 3.8
rmApplied associate-/l*3.9
Simplified3.6
rmApplied div-inv3.6
Simplified3.5
Final simplification2.1
herbie shell --seed 2019326 +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))