Average Error: 3.0 → 0.3
Time: 13.9s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\frac{\sin y}{y} \cdot x}{z} \le -5.699216469332027 \cdot 10^{+44}:\\ \;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\ \mathbf{elif}\;\frac{\frac{\sin y}{y} \cdot x}{z} \le 3.1854679199390606 \cdot 10^{-55}:\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{1}{\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}\;\frac{\frac{\sin y}{y} \cdot x}{z} \le -5.699216469332027 \cdot 10^{+44}:\\
\;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\

\mathbf{elif}\;\frac{\frac{\sin y}{y} \cdot x}{z} \le 3.1854679199390606 \cdot 10^{-55}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{1}{\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 r27020937 = x;
        double r27020938 = y;
        double r27020939 = sin(r27020938);
        double r27020940 = r27020939 / r27020938;
        double r27020941 = r27020937 * r27020940;
        double r27020942 = z;
        double r27020943 = r27020941 / r27020942;
        return r27020943;
}

double f(double x, double y, double z) {
        double r27020944 = y;
        double r27020945 = sin(r27020944);
        double r27020946 = r27020945 / r27020944;
        double r27020947 = x;
        double r27020948 = r27020946 * r27020947;
        double r27020949 = z;
        double r27020950 = r27020948 / r27020949;
        double r27020951 = -5.699216469332027e+44;
        bool r27020952 = r27020950 <= r27020951;
        double r27020953 = r27020949 / r27020946;
        double r27020954 = r27020947 / r27020953;
        double r27020955 = 3.1854679199390606e-55;
        bool r27020956 = r27020950 <= r27020955;
        double r27020957 = r27020947 / r27020949;
        double r27020958 = 1.0;
        double r27020959 = r27020958 / r27020946;
        double r27020960 = r27020957 / r27020959;
        double r27020961 = r27020956 ? r27020960 : r27020954;
        double r27020962 = r27020952 ? r27020954 : r27020961;
        return r27020962;
}

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

Original3.0
Target0.3
Herbie0.3
\[\begin{array}{l} \mathbf{if}\;z \lt -4.2173720203427147 \cdot 10^{-29}:\\ \;\;\;\;\frac{x \cdot \frac{1}{\frac{y}{\sin y}}}{z}\\ \mathbf{elif}\;z \lt 4.446702369113811 \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 (/ (* x (/ (sin y) y)) z) < -5.699216469332027e+44 or 3.1854679199390606e-55 < (/ (* x (/ (sin y) y)) z)

    1. Initial program 0.2

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

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

    if -5.699216469332027e+44 < (/ (* x (/ (sin y) y)) z) < 3.1854679199390606e-55

    1. Initial program 4.4

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\frac{\sin y}{y}}}}\]
    4. Using strategy rm
    5. Applied div-inv3.9

      \[\leadsto \frac{x}{\color{blue}{z \cdot \frac{1}{\frac{\sin y}{y}}}}\]
    6. Applied associate-/r*0.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\frac{\sin y}{y} \cdot x}{z} \le -5.699216469332027 \cdot 10^{+44}:\\ \;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\ \mathbf{elif}\;\frac{\frac{\sin y}{y} \cdot x}{z} \le 3.1854679199390606 \cdot 10^{-55}:\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{1}{\frac{\sin y}{y}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019164 
(FPCore (x y z)
  :name "Linear.Quaternion:$ctanh from linear-1.19.1.3"

  :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))