Average Error: 2.7 → 0.2
Time: 9.7s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -3.3341519654404754 \cdot 10^{-26} \lor \neg \left(z \le 20427325237287192\right):\\ \;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x}{\left(-z\right) \cdot \frac{y}{\sin y}}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;z \le -3.3341519654404754 \cdot 10^{-26} \lor \neg \left(z \le 20427325237287192\right):\\
\;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z}\\

\mathbf{else}:\\
\;\;\;\;\frac{-x}{\left(-z\right) \cdot \frac{y}{\sin y}}\\

\end{array}
double f(double x, double y, double z) {
        double r432871 = x;
        double r432872 = y;
        double r432873 = sin(r432872);
        double r432874 = r432873 / r432872;
        double r432875 = r432871 * r432874;
        double r432876 = z;
        double r432877 = r432875 / r432876;
        return r432877;
}

double f(double x, double y, double z) {
        double r432878 = z;
        double r432879 = -3.3341519654404754e-26;
        bool r432880 = r432878 <= r432879;
        double r432881 = 2.042732523728719e+16;
        bool r432882 = r432878 <= r432881;
        double r432883 = !r432882;
        bool r432884 = r432880 || r432883;
        double r432885 = x;
        double r432886 = y;
        double r432887 = sin(r432886);
        double r432888 = r432887 / r432886;
        double r432889 = r432885 * r432888;
        double r432890 = r432889 / r432878;
        double r432891 = -r432885;
        double r432892 = -r432878;
        double r432893 = r432886 / r432887;
        double r432894 = r432892 * r432893;
        double r432895 = r432891 / r432894;
        double r432896 = r432884 ? r432890 : r432895;
        return r432896;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original2.7
Target0.3
Herbie0.2
\[\begin{array}{l} \mathbf{if}\;z \lt -4.21737202034271466 \cdot 10^{-29}:\\ \;\;\;\;\frac{x \cdot \frac{1}{\frac{y}{\sin y}}}{z}\\ \mathbf{elif}\;z \lt 4.44670236911381103 \cdot 10^{64}:\\ \;\;\;\;\frac{x}{z \cdot \frac{y}{\sin y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{1}{\frac{y}{\sin y}}}{z}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -3.3341519654404754e-26 or 2.042732523728719e+16 < z

    1. Initial program 0.1

      \[\frac{x \cdot \frac{\sin y}{y}}{z}\]

    if -3.3341519654404754e-26 < z < 2.042732523728719e+16

    1. Initial program 5.9

      \[\frac{x \cdot \frac{\sin y}{y}}{z}\]
    2. Using strategy rm
    3. Applied clear-num6.0

      \[\leadsto \frac{x \cdot \color{blue}{\frac{1}{\frac{y}{\sin y}}}}{z}\]
    4. Using strategy rm
    5. Applied frac-2neg6.0

      \[\leadsto \color{blue}{\frac{-x \cdot \frac{1}{\frac{y}{\sin y}}}{-z}}\]
    6. Simplified5.9

      \[\leadsto \frac{\color{blue}{\frac{-x}{\frac{y}{\sin y}}}}{-z}\]
    7. Using strategy rm
    8. Applied associate-/l/0.2

      \[\leadsto \color{blue}{\frac{-x}{\left(-z\right) \cdot \frac{y}{\sin y}}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -3.3341519654404754 \cdot 10^{-26} \lor \neg \left(z \le 20427325237287192\right):\\ \;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x}{\left(-z\right) \cdot \frac{y}{\sin y}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020036 +o rules:numerics
(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))