Average Error: 3.0 → 0.3
Time: 15.3s
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 r17522598 = x;
        double r17522599 = y;
        double r17522600 = sin(r17522599);
        double r17522601 = r17522600 / r17522599;
        double r17522602 = r17522598 * r17522601;
        double r17522603 = z;
        double r17522604 = r17522602 / r17522603;
        return r17522604;
}

double f(double x, double y, double z) {
        double r17522605 = y;
        double r17522606 = sin(r17522605);
        double r17522607 = r17522606 / r17522605;
        double r17522608 = x;
        double r17522609 = r17522607 * r17522608;
        double r17522610 = z;
        double r17522611 = r17522609 / r17522610;
        double r17522612 = -5.699216469332027e+44;
        bool r17522613 = r17522611 <= r17522612;
        double r17522614 = r17522610 / r17522607;
        double r17522615 = r17522608 / r17522614;
        double r17522616 = 3.1854679199390606e-55;
        bool r17522617 = r17522611 <= r17522616;
        double r17522618 = r17522608 / r17522610;
        double r17522619 = 1.0;
        double r17522620 = r17522619 / r17522607;
        double r17522621 = r17522618 / r17522620;
        double r17522622 = r17522617 ? r17522621 : r17522615;
        double r17522623 = r17522613 ? r17522615 : r17522622;
        return r17522623;
}

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 +o rules:numerics
(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))