\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -7.255320694630306831846011661468764941674 \cdot 10^{-4} \lor \neg \left(z \le 2.126137581571963274216038367069096111718 \cdot 10^{-41}\right):\\
\;\;\;\;\frac{1}{2} \cdot \frac{x \cdot y}{z} + \frac{y}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{z}{\cosh x} \cdot \left(\frac{1}{y} \cdot x\right)}\\
\end{array}double f(double x, double y, double z) {
double r324463 = x;
double r324464 = cosh(r324463);
double r324465 = y;
double r324466 = r324465 / r324463;
double r324467 = r324464 * r324466;
double r324468 = z;
double r324469 = r324467 / r324468;
return r324469;
}
double f(double x, double y, double z) {
double r324470 = z;
double r324471 = -0.0007255320694630307;
bool r324472 = r324470 <= r324471;
double r324473 = 2.1261375815719633e-41;
bool r324474 = r324470 <= r324473;
double r324475 = !r324474;
bool r324476 = r324472 || r324475;
double r324477 = 0.5;
double r324478 = x;
double r324479 = y;
double r324480 = r324478 * r324479;
double r324481 = r324480 / r324470;
double r324482 = r324477 * r324481;
double r324483 = r324478 * r324470;
double r324484 = r324479 / r324483;
double r324485 = r324482 + r324484;
double r324486 = 1.0;
double r324487 = cosh(r324478);
double r324488 = r324470 / r324487;
double r324489 = r324486 / r324479;
double r324490 = r324489 * r324478;
double r324491 = r324488 * r324490;
double r324492 = r324486 / r324491;
double r324493 = r324476 ? r324485 : r324492;
return r324493;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.4 |
|---|---|
| Target | 0.4 |
| Herbie | 0.9 |
if z < -0.0007255320694630307 or 2.1261375815719633e-41 < z Initial program 10.6
Taylor expanded around 0 1.0
if -0.0007255320694630307 < z < 2.1261375815719633e-41Initial program 0.3
rmApplied add-exp-log0.3
rmApplied div-inv0.4
Applied associate-*r*0.4
Simplified0.4
rmApplied clear-num0.5
Simplified0.5
rmApplied div-inv0.5
Applied div-inv0.6
Applied times-frac0.6
Simplified0.5
Final simplification0.9
herbie shell --seed 1978988140
(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.03853053593515302e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))
(/ (* (cosh x) (/ y x)) z))