\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;y \le -2.108045198460169534729664699359786352891 \cdot 10^{-61} \lor \neg \left(y \le 4.48169197924863956927649820888772435422 \cdot 10^{-26}\right):\\
\;\;\;\;\frac{\frac{\cosh x \cdot y}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cosh x \cdot y}{x}}{z}\\
\end{array}double f(double x, double y, double z) {
double r329325 = x;
double r329326 = cosh(r329325);
double r329327 = y;
double r329328 = r329327 / r329325;
double r329329 = r329326 * r329328;
double r329330 = z;
double r329331 = r329329 / r329330;
return r329331;
}
double f(double x, double y, double z) {
double r329332 = y;
double r329333 = -2.1080451984601695e-61;
bool r329334 = r329332 <= r329333;
double r329335 = 4.4816919792486396e-26;
bool r329336 = r329332 <= r329335;
double r329337 = !r329336;
bool r329338 = r329334 || r329337;
double r329339 = x;
double r329340 = cosh(r329339);
double r329341 = r329340 * r329332;
double r329342 = z;
double r329343 = r329341 / r329342;
double r329344 = r329343 / r329339;
double r329345 = r329341 / r329339;
double r329346 = r329345 / r329342;
double r329347 = r329338 ? r329344 : r329346;
return r329347;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 8.0 |
|---|---|
| Target | 0.4 |
| Herbie | 0.4 |
if y < -2.1080451984601695e-61 or 4.4816919792486396e-26 < y Initial program 18.1
rmApplied div-inv18.1
Applied associate-*r*18.1
rmApplied clear-num18.2
Simplified0.9
rmApplied associate-/r*0.9
Simplified0.6
if -2.1080451984601695e-61 < y < 4.4816919792486396e-26Initial program 0.3
rmApplied div-inv0.4
Applied associate-*r*0.4
rmApplied associate-*r/0.3
Simplified0.3
Final simplification0.4
herbie shell --seed 2019179 +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))