\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -3.383191592887115717553319195823324783134 \cdot 10^{-8} \lor \neg \left(z \le 3.03355591603155297168608427108120014315 \cdot 10^{-25}\right):\\
\;\;\;\;\frac{\cosh x \cdot y}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cosh x \cdot y}{z}}{x}\\
\end{array}double f(double x, double y, double z) {
double r420292 = x;
double r420293 = cosh(r420292);
double r420294 = y;
double r420295 = r420294 / r420292;
double r420296 = r420293 * r420295;
double r420297 = z;
double r420298 = r420296 / r420297;
return r420298;
}
double f(double x, double y, double z) {
double r420299 = z;
double r420300 = -3.383191592887116e-08;
bool r420301 = r420299 <= r420300;
double r420302 = 3.033555916031553e-25;
bool r420303 = r420299 <= r420302;
double r420304 = !r420303;
bool r420305 = r420301 || r420304;
double r420306 = x;
double r420307 = cosh(r420306);
double r420308 = y;
double r420309 = r420307 * r420308;
double r420310 = r420306 * r420299;
double r420311 = r420309 / r420310;
double r420312 = r420309 / r420299;
double r420313 = r420312 / r420306;
double r420314 = r420305 ? r420311 : r420313;
return r420314;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.8 |
|---|---|
| Target | 0.5 |
| Herbie | 0.3 |
if z < -3.383191592887116e-08 or 3.033555916031553e-25 < z Initial program 11.4
rmApplied div-inv11.5
rmApplied associate-*r/11.5
Applied associate-*l/10.7
Simplified10.6
rmApplied div-inv10.7
Applied associate-/l*0.4
Simplified0.3
if -3.383191592887116e-08 < z < 3.033555916031553e-25Initial program 0.3
rmApplied div-inv0.4
rmApplied associate-*r/0.4
Applied associate-*l/0.4
Simplified0.3
Final simplification0.3
herbie shell --seed 2020002
(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))