\frac{x \cdot \frac{\sin y}{y}}{z}\begin{array}{l}
\mathbf{if}\;z \le -4.99748861820327434 \cdot 10^{41} \lor \neg \left(z \le 5.7247708611607825 \cdot 10^{66}\right):\\
\;\;\;\;\frac{x \cdot \left(\sin y \cdot \frac{1}{y}\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z \cdot \frac{y}{\sin y}}\\
\end{array}double f(double x, double y, double z) {
double r649651 = x;
double r649652 = y;
double r649653 = sin(r649652);
double r649654 = r649653 / r649652;
double r649655 = r649651 * r649654;
double r649656 = z;
double r649657 = r649655 / r649656;
return r649657;
}
double f(double x, double y, double z) {
double r649658 = z;
double r649659 = -4.997488618203274e+41;
bool r649660 = r649658 <= r649659;
double r649661 = 5.7247708611607825e+66;
bool r649662 = r649658 <= r649661;
double r649663 = !r649662;
bool r649664 = r649660 || r649663;
double r649665 = x;
double r649666 = y;
double r649667 = sin(r649666);
double r649668 = 1.0;
double r649669 = r649668 / r649666;
double r649670 = r649667 * r649669;
double r649671 = r649665 * r649670;
double r649672 = r649671 / r649658;
double r649673 = r649666 / r649667;
double r649674 = r649658 * r649673;
double r649675 = r649665 / r649674;
double r649676 = r649664 ? r649672 : r649675;
return r649676;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 2.8 |
|---|---|
| Target | 0.3 |
| Herbie | 0.3 |
if z < -4.997488618203274e+41 or 5.7247708611607825e+66 < z Initial program 0.1
rmApplied div-inv0.2
if -4.997488618203274e+41 < z < 5.7247708611607825e+66Initial program 5.0
rmApplied associate-/l*0.4
Simplified0.4
Final simplification0.3
herbie shell --seed 2020043
(FPCore (x y z)
:name "Linear.Quaternion:$ctanh from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< z -4.2173720203427147e-29) (/ (* x (/ 1 (/ y (sin y)))) z) (if (< z 4.446702369113811e+64) (/ x (* z (/ y (sin y)))) (/ (* x (/ 1 (/ y (sin y)))) z)))
(/ (* x (/ (sin y) y)) z))