Average Error: 2.6 → 0.3
Time: 19.0s
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 r996603 = x;
        double r996604 = y;
        double r996605 = sin(r996604);
        double r996606 = r996605 / r996604;
        double r996607 = r996603 * r996606;
        double r996608 = z;
        double r996609 = r996607 / r996608;
        return r996609;
}

double f(double x, double y, double z) {
        double r996610 = z;
        double r996611 = -1.303123016424891e+26;
        bool r996612 = r996610 <= r996611;
        double r996613 = 1.127503885584835e+69;
        bool r996614 = r996610 <= r996613;
        double r996615 = !r996614;
        bool r996616 = r996612 || r996615;
        double r996617 = x;
        double r996618 = r996617 / r996610;
        double r996619 = y;
        double r996620 = sin(r996619);
        double r996621 = r996619 / r996620;
        double r996622 = r996618 / r996621;
        double r996623 = r996610 * r996621;
        double r996624 = r996617 / r996623;
        double r996625 = r996616 ? r996622 : r996624;
        return r996625;
}

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))