Average Error: 2.9 → 1.0
Time: 4.4s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -6.6091788831885175 \cdot 10^{198}:\\ \;\;\;\;\frac{x \cdot \left(\sin y \cdot \frac{1}{y}\right)}{z}\\ \mathbf{elif}\;z \le 9.28239712100140934 \cdot 10^{-126}:\\ \;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{1}{\frac{y}{\sin y}}}{z}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;z \le -6.6091788831885175 \cdot 10^{198}:\\
\;\;\;\;\frac{x \cdot \left(\sin y \cdot \frac{1}{y}\right)}{z}\\

\mathbf{elif}\;z \le 9.28239712100140934 \cdot 10^{-126}:\\
\;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\

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

\end{array}
double f(double x, double y, double z) {
        double r477552 = x;
        double r477553 = y;
        double r477554 = sin(r477553);
        double r477555 = r477554 / r477553;
        double r477556 = r477552 * r477555;
        double r477557 = z;
        double r477558 = r477556 / r477557;
        return r477558;
}

double f(double x, double y, double z) {
        double r477559 = z;
        double r477560 = -6.609178883188517e+198;
        bool r477561 = r477559 <= r477560;
        double r477562 = x;
        double r477563 = y;
        double r477564 = sin(r477563);
        double r477565 = 1.0;
        double r477566 = r477565 / r477563;
        double r477567 = r477564 * r477566;
        double r477568 = r477562 * r477567;
        double r477569 = r477568 / r477559;
        double r477570 = 9.282397121001409e-126;
        bool r477571 = r477559 <= r477570;
        double r477572 = r477564 / r477563;
        double r477573 = r477559 / r477572;
        double r477574 = r477562 / r477573;
        double r477575 = r477563 / r477564;
        double r477576 = r477565 / r477575;
        double r477577 = r477562 * r477576;
        double r477578 = r477577 / r477559;
        double r477579 = r477571 ? r477574 : r477578;
        double r477580 = r477561 ? r477569 : r477579;
        return r477580;
}

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.2
Herbie1.0
\[\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 3 regimes
  2. if z < -6.609178883188517e+198

    1. Initial program 0.1

      \[\frac{x \cdot \frac{\sin y}{y}}{z}\]
    2. Using strategy rm
    3. Applied div-inv0.1

      \[\leadsto \frac{x \cdot \color{blue}{\left(\sin y \cdot \frac{1}{y}\right)}}{z}\]

    if -6.609178883188517e+198 < z < 9.282397121001409e-126

    1. Initial program 4.9

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

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

    if 9.282397121001409e-126 < z

    1. Initial program 0.8

      \[\frac{x \cdot \frac{\sin y}{y}}{z}\]
    2. Using strategy rm
    3. Applied clear-num0.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -6.6091788831885175 \cdot 10^{198}:\\ \;\;\;\;\frac{x \cdot \left(\sin y \cdot \frac{1}{y}\right)}{z}\\ \mathbf{elif}\;z \le 9.28239712100140934 \cdot 10^{-126}:\\ \;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{1}{\frac{y}{\sin y}}}{z}\\ \end{array}\]

Reproduce

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