Average Error: 2.6 → 0.3
Time: 19.6s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -130312301642489093169348608 \lor \neg \left(z \le 1.127503885584835035756866392214263129945 \cdot 10^{69}\right):\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{y}{\sin 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 -130312301642489093169348608 \lor \neg \left(z \le 1.127503885584835035756866392214263129945 \cdot 10^{69}\right):\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{y}{\sin y}}\\

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

\end{array}
double f(double x, double y, double z) {
        double r621147 = x;
        double r621148 = y;
        double r621149 = sin(r621148);
        double r621150 = r621149 / r621148;
        double r621151 = r621147 * r621150;
        double r621152 = z;
        double r621153 = r621151 / r621152;
        return r621153;
}

double f(double x, double y, double z) {
        double r621154 = z;
        double r621155 = -1.303123016424891e+26;
        bool r621156 = r621154 <= r621155;
        double r621157 = 1.127503885584835e+69;
        bool r621158 = r621154 <= r621157;
        double r621159 = !r621158;
        bool r621160 = r621156 || r621159;
        double r621161 = x;
        double r621162 = r621161 / r621154;
        double r621163 = y;
        double r621164 = sin(r621163);
        double r621165 = r621163 / r621164;
        double r621166 = r621162 / r621165;
        double r621167 = r621154 * r621165;
        double r621168 = r621161 / r621167;
        double r621169 = r621160 ? r621166 : r621168;
        return r621169;
}

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.6
Target0.3
Herbie0.3
\[\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 2 regimes
  2. if z < -1.303123016424891e+26 or 1.127503885584835e+69 < z

    1. Initial program 0.1

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\frac{\sin y}{y}}}}\]
    4. Simplified6.2

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

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

    if -1.303123016424891e+26 < z < 1.127503885584835e+69

    1. Initial program 4.7

      \[\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}}}}\]
    4. Simplified0.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -130312301642489093169348608 \lor \neg \left(z \le 1.127503885584835035756866392214263129945 \cdot 10^{69}\right):\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{y}{\sin y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z \cdot \frac{y}{\sin y}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019303 +o rules:numerics
(FPCore (x y z)
  :name "Linear.Quaternion:$ctanh from linear-1.19.1.3"
  :precision binary64

  :herbie-target
  (if (< z -4.21737202034271466e-29) (/ (* x (/ 1 (/ y (sin y)))) z) (if (< z 4.44670236911381103e64) (/ x (* z (/ y (sin y)))) (/ (* x (/ 1 (/ y (sin y)))) z)))

  (/ (* x (/ (sin y) y)) z))