Average Error: 2.7 → 0.3
Time: 18.0s
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 r343439 = x;
        double r343440 = y;
        double r343441 = sin(r343440);
        double r343442 = r343441 / r343440;
        double r343443 = r343439 * r343442;
        double r343444 = z;
        double r343445 = r343443 / r343444;
        return r343445;
}

double f(double x, double y, double z) {
        double r343446 = x;
        double r343447 = y;
        double r343448 = sin(r343447);
        double r343449 = r343448 / r343447;
        double r343450 = r343446 * r343449;
        double r343451 = -6.319714735762894e-124;
        bool r343452 = r343450 <= r343451;
        double r343453 = 6.641146027642848e-283;
        bool r343454 = r343450 <= r343453;
        double r343455 = !r343454;
        bool r343456 = r343452 || r343455;
        double r343457 = z;
        double r343458 = r343450 / r343457;
        double r343459 = r343446 / r343457;
        double r343460 = r343447 / r343448;
        double r343461 = r343459 / r343460;
        double r343462 = r343456 ? r343458 : r343461;
        return r343462;
}

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