Average Error: 2.7 → 0.3
Time: 19.7s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot \frac{\sin y}{y} \le -6.319714735762894040261866058671149783272 \cdot 10^{-124} \lor \neg \left(x \cdot \frac{\sin y}{y} \le 6.641146027642848148772445195187677057815 \cdot 10^{-283}\right):\\ \;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{y}{\sin y}}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot \frac{\sin y}{y} \le -6.319714735762894040261866058671149783272 \cdot 10^{-124} \lor \neg \left(x \cdot \frac{\sin y}{y} \le 6.641146027642848148772445195187677057815 \cdot 10^{-283}\right):\\
\;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r295997 = x;
        double r295998 = y;
        double r295999 = sin(r295998);
        double r296000 = r295999 / r295998;
        double r296001 = r295997 * r296000;
        double r296002 = z;
        double r296003 = r296001 / r296002;
        return r296003;
}

double f(double x, double y, double z) {
        double r296004 = x;
        double r296005 = y;
        double r296006 = sin(r296005);
        double r296007 = r296006 / r296005;
        double r296008 = r296004 * r296007;
        double r296009 = -6.319714735762894e-124;
        bool r296010 = r296008 <= r296009;
        double r296011 = 6.641146027642848e-283;
        bool r296012 = r296008 <= r296011;
        double r296013 = !r296012;
        bool r296014 = r296010 || r296013;
        double r296015 = z;
        double r296016 = r296008 / r296015;
        double r296017 = r296004 / r296015;
        double r296018 = r296005 / r296006;
        double r296019 = r296017 / r296018;
        double r296020 = r296014 ? r296016 : r296019;
        return r296020;
}

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.3
\[\begin{array}{l} \mathbf{if}\;z \lt -4.217372020342714661850238929213415773451 \cdot 10^{-29}:\\ \;\;\;\;\frac{x \cdot \frac{1}{\frac{y}{\sin y}}}{z}\\ \mathbf{elif}\;z \lt 4.446702369113811028051510715777703865332 \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)) < -6.319714735762894e-124 or 6.641146027642848e-283 < (* x (/ (sin y) y))

    1. Initial program 0.2

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

    if -6.319714735762894e-124 < (* x (/ (sin y) y)) < 6.641146027642848e-283

    1. Initial program 8.0

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\frac{\sin y}{y}}}}\]
    4. Simplified0.7

      \[\leadsto \frac{x}{\color{blue}{z \cdot \frac{y}{\sin y}}}\]
    5. Using strategy rm
    6. Applied associate-/r*0.5

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

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

Reproduce

herbie shell --seed 2019325 +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))