Average Error: 3.0 → 0.8
Time: 4.0s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.1728892342568057 \cdot 10^{-27}:\\ \;\;\;\;\frac{x \cdot \left(\sin y \cdot \frac{1}{y}\right)}{z}\\ \mathbf{elif}\;z \le 1.32101974044890363 \cdot 10^{187}:\\ \;\;\;\;\frac{1 \cdot x}{z \cdot \frac{y}{\sin y}}\\ \mathbf{else}:\\ \;\;\;\;\left(1 \cdot \frac{x}{\frac{y}{\sin y}}\right) \cdot \frac{1}{z}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;z \le -1.1728892342568057 \cdot 10^{-27}:\\
\;\;\;\;\frac{x \cdot \left(\sin y \cdot \frac{1}{y}\right)}{z}\\

\mathbf{elif}\;z \le 1.32101974044890363 \cdot 10^{187}:\\
\;\;\;\;\frac{1 \cdot x}{z \cdot \frac{y}{\sin y}}\\

\mathbf{else}:\\
\;\;\;\;\left(1 \cdot \frac{x}{\frac{y}{\sin y}}\right) \cdot \frac{1}{z}\\

\end{array}
double f(double x, double y, double z) {
        double r480833 = x;
        double r480834 = y;
        double r480835 = sin(r480834);
        double r480836 = r480835 / r480834;
        double r480837 = r480833 * r480836;
        double r480838 = z;
        double r480839 = r480837 / r480838;
        return r480839;
}

double f(double x, double y, double z) {
        double r480840 = z;
        double r480841 = -1.1728892342568057e-27;
        bool r480842 = r480840 <= r480841;
        double r480843 = x;
        double r480844 = y;
        double r480845 = sin(r480844);
        double r480846 = 1.0;
        double r480847 = r480846 / r480844;
        double r480848 = r480845 * r480847;
        double r480849 = r480843 * r480848;
        double r480850 = r480849 / r480840;
        double r480851 = 1.3210197404489036e+187;
        bool r480852 = r480840 <= r480851;
        double r480853 = r480846 * r480843;
        double r480854 = r480844 / r480845;
        double r480855 = r480840 * r480854;
        double r480856 = r480853 / r480855;
        double r480857 = r480843 / r480854;
        double r480858 = r480846 * r480857;
        double r480859 = r480846 / r480840;
        double r480860 = r480858 * r480859;
        double r480861 = r480852 ? r480856 : r480860;
        double r480862 = r480842 ? r480850 : r480861;
        return r480862;
}

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.8
\[\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 < -1.1728892342568057e-27

    1. Initial program 0.2

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

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

    if -1.1728892342568057e-27 < z < 1.3210197404489036e+187

    1. Initial program 4.8

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

      \[\leadsto \frac{x \cdot \color{blue}{\frac{1}{\frac{y}{\sin y}}}}{z}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity4.9

      \[\leadsto \frac{\color{blue}{\left(1 \cdot x\right)} \cdot \frac{1}{\frac{y}{\sin y}}}{z}\]
    6. Applied associate-*l*4.9

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

      \[\leadsto \frac{1 \cdot \color{blue}{\frac{x}{\frac{y}{\sin y}}}}{z}\]
    8. Using strategy rm
    9. Applied associate-*r/4.8

      \[\leadsto \frac{\color{blue}{\frac{1 \cdot x}{\frac{y}{\sin y}}}}{z}\]
    10. Applied associate-/l/1.1

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

    if 1.3210197404489036e+187 < z

    1. Initial program 0.1

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

      \[\leadsto \frac{x \cdot \color{blue}{\frac{1}{\frac{y}{\sin y}}}}{z}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity0.1

      \[\leadsto \frac{\color{blue}{\left(1 \cdot x\right)} \cdot \frac{1}{\frac{y}{\sin y}}}{z}\]
    6. Applied associate-*l*0.1

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

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

      \[\leadsto \color{blue}{\left(1 \cdot \frac{x}{\frac{y}{\sin y}}\right) \cdot \frac{1}{z}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.1728892342568057 \cdot 10^{-27}:\\ \;\;\;\;\frac{x \cdot \left(\sin y \cdot \frac{1}{y}\right)}{z}\\ \mathbf{elif}\;z \le 1.32101974044890363 \cdot 10^{187}:\\ \;\;\;\;\frac{1 \cdot x}{z \cdot \frac{y}{\sin y}}\\ \mathbf{else}:\\ \;\;\;\;\left(1 \cdot \frac{x}{\frac{y}{\sin y}}\right) \cdot \frac{1}{z}\\ \end{array}\]

Reproduce

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