Average Error: 2.8 → 0.5
Time: 10.9s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -3.126929288024238297232353227899211696157 \cdot 10^{139}:\\ \;\;\;\;\frac{x \cdot \frac{1}{\frac{y}{\sin y}}}{z}\\ \mathbf{elif}\;z \le 7.288354638204399615341079828710618574231 \cdot 10^{-12}:\\ \;\;\;\;\frac{x}{z \cdot \frac{y}{\sin y}}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \frac{\sin y}{y}\right) \cdot \frac{1}{z}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;z \le -3.126929288024238297232353227899211696157 \cdot 10^{139}:\\
\;\;\;\;\frac{x \cdot \frac{1}{\frac{y}{\sin y}}}{z}\\

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

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

\end{array}
double f(double x, double y, double z) {
        double r585850 = x;
        double r585851 = y;
        double r585852 = sin(r585851);
        double r585853 = r585852 / r585851;
        double r585854 = r585850 * r585853;
        double r585855 = z;
        double r585856 = r585854 / r585855;
        return r585856;
}

double f(double x, double y, double z) {
        double r585857 = z;
        double r585858 = -3.1269292880242383e+139;
        bool r585859 = r585857 <= r585858;
        double r585860 = x;
        double r585861 = 1.0;
        double r585862 = y;
        double r585863 = sin(r585862);
        double r585864 = r585862 / r585863;
        double r585865 = r585861 / r585864;
        double r585866 = r585860 * r585865;
        double r585867 = r585866 / r585857;
        double r585868 = 7.2883546382044e-12;
        bool r585869 = r585857 <= r585868;
        double r585870 = r585857 * r585864;
        double r585871 = r585860 / r585870;
        double r585872 = r585863 / r585862;
        double r585873 = r585860 * r585872;
        double r585874 = r585861 / r585857;
        double r585875 = r585873 * r585874;
        double r585876 = r585869 ? r585871 : r585875;
        double r585877 = r585859 ? r585867 : r585876;
        return r585877;
}

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.8
Target0.3
Herbie0.5
\[\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 3 regimes
  2. if z < -3.1269292880242383e+139

    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}\]

    if -3.1269292880242383e+139 < z < 7.2883546382044e-12

    1. Initial program 4.9

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\frac{\sin y}{y}}}}\]
    4. Simplified0.8

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

    if 7.2883546382044e-12 < z

    1. Initial program 0.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -3.126929288024238297232353227899211696157 \cdot 10^{139}:\\ \;\;\;\;\frac{x \cdot \frac{1}{\frac{y}{\sin y}}}{z}\\ \mathbf{elif}\;z \le 7.288354638204399615341079828710618574231 \cdot 10^{-12}:\\ \;\;\;\;\frac{x}{z \cdot \frac{y}{\sin y}}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \frac{\sin y}{y}\right) \cdot \frac{1}{z}\\ \end{array}\]

Reproduce

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