\frac{x \cdot \frac{\sin y}{y}}{z}\begin{array}{l}
\mathbf{if}\;\frac{\sin y}{y} \cdot x \le -1.794335516845841475026763291211245703492 \cdot 10^{-304}:\\
\;\;\;\;\frac{x \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\sin y}{y}\right)\right)}{z}\\
\mathbf{elif}\;\frac{\sin y}{y} \cdot x \le 8.450034510697123808431823271123881050474 \cdot 10^{-302}:\\
\;\;\;\;\frac{x \cdot \sin y}{z \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\sin y}{y}\right)\right)}{z}\\
\end{array}double f(double x, double y, double z) {
double r25993014 = x;
double r25993015 = y;
double r25993016 = sin(r25993015);
double r25993017 = r25993016 / r25993015;
double r25993018 = r25993014 * r25993017;
double r25993019 = z;
double r25993020 = r25993018 / r25993019;
return r25993020;
}
double f(double x, double y, double z) {
double r25993021 = y;
double r25993022 = sin(r25993021);
double r25993023 = r25993022 / r25993021;
double r25993024 = x;
double r25993025 = r25993023 * r25993024;
double r25993026 = -1.7943355168458415e-304;
bool r25993027 = r25993025 <= r25993026;
double r25993028 = log1p(r25993023);
double r25993029 = expm1(r25993028);
double r25993030 = r25993024 * r25993029;
double r25993031 = z;
double r25993032 = r25993030 / r25993031;
double r25993033 = 8.450034510697124e-302;
bool r25993034 = r25993025 <= r25993033;
double r25993035 = r25993024 * r25993022;
double r25993036 = r25993031 * r25993021;
double r25993037 = r25993035 / r25993036;
double r25993038 = r25993034 ? r25993037 : r25993032;
double r25993039 = r25993027 ? r25993032 : r25993038;
return r25993039;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 2.7 |
|---|---|
| Target | 0.3 |
| Herbie | 0.3 |
if (* x (/ (sin y) y)) < -1.7943355168458415e-304 or 8.450034510697124e-302 < (* x (/ (sin y) y)) Initial program 0.2
rmApplied expm1-log1p-u0.2
if -1.7943355168458415e-304 < (* x (/ (sin y) y)) < 8.450034510697124e-302Initial program 17.4
rmApplied associate-*r/18.4
Applied associate-/l/1.2
Final simplification0.3
herbie shell --seed 2019170 +o rules:numerics
(FPCore (x y z)
:name "Linear.Quaternion:$ctanh from linear-1.19.1.3"
:herbie-target
(if (< z -4.2173720203427147e-29) (/ (* x (/ 1.0 (/ y (sin y)))) z) (if (< z 4.446702369113811e+64) (/ x (* z (/ y (sin y)))) (/ (* x (/ 1.0 (/ y (sin y)))) z)))
(/ (* x (/ (sin y) y)) z))