Average Error: 2.6 → 0.3
Time: 22.8s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.94523853728173715 \cdot 10^{77} \lor \neg \left(z \le 5.77037772052017817 \cdot 10^{-8}\right):\\ \;\;\;\;\frac{x}{z} \cdot \frac{\sin y}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;z \le -1.94523853728173715 \cdot 10^{77} \lor \neg \left(z \le 5.77037772052017817 \cdot 10^{-8}\right):\\
\;\;\;\;\frac{x}{z} \cdot \frac{\sin y}{y}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\

\end{array}
double f(double x, double y, double z) {
        double r367937 = x;
        double r367938 = y;
        double r367939 = sin(r367938);
        double r367940 = r367939 / r367938;
        double r367941 = r367937 * r367940;
        double r367942 = z;
        double r367943 = r367941 / r367942;
        return r367943;
}

double f(double x, double y, double z) {
        double r367944 = z;
        double r367945 = -1.9452385372817372e+77;
        bool r367946 = r367944 <= r367945;
        double r367947 = 5.770377720520178e-08;
        bool r367948 = r367944 <= r367947;
        double r367949 = !r367948;
        bool r367950 = r367946 || r367949;
        double r367951 = x;
        double r367952 = r367951 / r367944;
        double r367953 = y;
        double r367954 = sin(r367953);
        double r367955 = r367954 / r367953;
        double r367956 = r367952 * r367955;
        double r367957 = r367944 / r367955;
        double r367958 = r367951 / r367957;
        double r367959 = r367950 ? r367956 : r367958;
        return r367959;
}

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.6
Target0.2
Herbie0.3
\[\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 < -1.9452385372817372e+77 or 5.770377720520178e-08 < z

    1. Initial program 0.1

      \[\frac{x \cdot \frac{\sin y}{y}}{z}\]
    2. Using strategy rm
    3. Applied associate-/l*5.9

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\frac{\sin y}{y}}}}\]
    4. Using strategy rm
    5. Applied associate-/r/0.1

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{\sin y}{y}}\]

    if -1.9452385372817372e+77 < z < 5.770377720520178e-08

    1. Initial program 4.9

      \[\frac{x \cdot \frac{\sin y}{y}}{z}\]
    2. Using strategy rm
    3. Applied associate-/l*0.5

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

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

Reproduce

herbie shell --seed 2019199 
(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))