Average Error: 2.9 → 1.5
Time: 7.7s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -7.37385740450310983 \cdot 10^{23}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{\sin y}{y}\\ \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 -7.37385740450310983 \cdot 10^{23}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{\sin y}{y}\\

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

\end{array}
double f(double x, double y, double z) {
        double r82982 = x;
        double r82983 = y;
        double r82984 = sin(r82983);
        double r82985 = r82984 / r82983;
        double r82986 = r82982 * r82985;
        double r82987 = z;
        double r82988 = r82986 / r82987;
        return r82988;
}

double f(double x, double y, double z) {
        double r82989 = z;
        double r82990 = -7.37385740450311e+23;
        bool r82991 = r82989 <= r82990;
        double r82992 = x;
        double r82993 = r82992 / r82989;
        double r82994 = y;
        double r82995 = sin(r82994);
        double r82996 = r82995 / r82994;
        double r82997 = r82993 * r82996;
        double r82998 = r82994 / r82995;
        double r82999 = r82989 * r82998;
        double r83000 = r82992 / r82999;
        double r83001 = r82991 ? r82997 : r83000;
        return r83001;
}

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.9
Target0.3
Herbie1.5
\[\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 < -7.37385740450311e+23

    1. Initial program 0.1

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\frac{\sin y}{y}}}}\]
    4. Using strategy rm
    5. Applied associate-/r/0.1

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

    if -7.37385740450311e+23 < z

    1. Initial program 3.8

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\frac{\sin y}{y}}}}\]
    4. Using strategy rm
    5. Applied associate-/r/3.8

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{\sin y}{y}}\]
    6. Using strategy rm
    7. Applied clear-num3.8

      \[\leadsto \frac{x}{z} \cdot \color{blue}{\frac{1}{\frac{y}{\sin y}}}\]
    8. Using strategy rm
    9. Applied frac-times2.0

      \[\leadsto \color{blue}{\frac{x \cdot 1}{z \cdot \frac{y}{\sin y}}}\]
    10. Simplified2.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -7.37385740450310983 \cdot 10^{23}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{\sin y}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z \cdot \frac{y}{\sin y}}\\ \end{array}\]

Reproduce

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