\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;y \le -41.67494460546429735359197366051375865936:\\
\;\;\;\;\frac{\frac{1}{2}}{x} \cdot \frac{e^{-x} + e^{x}}{\frac{z}{y}}\\
\mathbf{elif}\;y \le 6.315061908017308627405584932781533751405 \cdot 10^{-61}:\\
\;\;\;\;\frac{\frac{y}{x} \cdot \left(\frac{1}{2} \cdot \left(e^{-x} + e^{x}\right)\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\cosh x \cdot \frac{\frac{y}{z}}{x}\\
\end{array}double f(double x, double y, double z) {
double r481128 = x;
double r481129 = cosh(r481128);
double r481130 = y;
double r481131 = r481130 / r481128;
double r481132 = r481129 * r481131;
double r481133 = z;
double r481134 = r481132 / r481133;
return r481134;
}
double f(double x, double y, double z) {
double r481135 = y;
double r481136 = -41.6749446054643;
bool r481137 = r481135 <= r481136;
double r481138 = 0.5;
double r481139 = x;
double r481140 = r481138 / r481139;
double r481141 = -r481139;
double r481142 = exp(r481141);
double r481143 = exp(r481139);
double r481144 = r481142 + r481143;
double r481145 = z;
double r481146 = r481145 / r481135;
double r481147 = r481144 / r481146;
double r481148 = r481140 * r481147;
double r481149 = 6.315061908017309e-61;
bool r481150 = r481135 <= r481149;
double r481151 = r481135 / r481139;
double r481152 = r481138 * r481144;
double r481153 = r481151 * r481152;
double r481154 = r481153 / r481145;
double r481155 = cosh(r481139);
double r481156 = r481135 / r481145;
double r481157 = r481156 / r481139;
double r481158 = r481155 * r481157;
double r481159 = r481150 ? r481154 : r481158;
double r481160 = r481137 ? r481148 : r481159;
return r481160;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 8.0 |
|---|---|
| Target | 0.5 |
| Herbie | 0.5 |
if y < -41.6749446054643Initial program 21.2
Simplified0.3
Taylor expanded around inf 0.4
Simplified0.5
if -41.6749446054643 < y < 6.315061908017309e-61Initial program 0.3
Simplified10.9
rmApplied div-inv11.9
Applied associate-*l*11.9
Simplified11.9
Taylor expanded around -inf 10.9
Simplified0.3
if 6.315061908017309e-61 < y Initial program 16.7
Simplified0.8
rmApplied *-un-lft-identity0.8
Applied associate-*l*0.8
Simplified0.9
Final simplification0.5
herbie shell --seed 2019174
(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))