Average Error: 2.7 → 0.2
Time: 9.5s
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}{z \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}{z \cdot \frac{y}{\sin y}}\\

\end{array}
double f(double x, double y, double z) {
        double r548244 = x;
        double r548245 = y;
        double r548246 = sin(r548245);
        double r548247 = r548246 / r548245;
        double r548248 = r548244 * r548247;
        double r548249 = z;
        double r548250 = r548248 / r548249;
        return r548250;
}

double f(double x, double y, double z) {
        double r548251 = z;
        double r548252 = -3.3341519654404754e-26;
        bool r548253 = r548251 <= r548252;
        double r548254 = 2.042732523728719e+16;
        bool r548255 = r548251 <= r548254;
        double r548256 = !r548255;
        bool r548257 = r548253 || r548256;
        double r548258 = x;
        double r548259 = y;
        double r548260 = sin(r548259);
        double r548261 = r548260 / r548259;
        double r548262 = r548258 * r548261;
        double r548263 = r548262 / r548251;
        double r548264 = r548259 / r548260;
        double r548265 = r548251 * r548264;
        double r548266 = r548258 / r548265;
        double r548267 = r548257 ? r548263 : r548266;
        return r548267;
}

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 associate-/l*0.3

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\frac{1}{\frac{y}{\sin y}}}}}\]
    6. Simplified0.2

      \[\leadsto \frac{x}{\color{blue}{z \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}{z \cdot \frac{y}{\sin y}}\\ \end{array}\]

Reproduce

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