Average Error: 2.7 → 0.2
Time: 5.3s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -3.3341519654404754 \cdot 10^{-26} \lor \neg \left(z \le 20427325237287192\right):\\ \;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot 1}{z \cdot \frac{y}{\sin y}}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;z \le -3.3341519654404754 \cdot 10^{-26} \lor \neg \left(z \le 20427325237287192\right):\\
\;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r435721 = x;
        double r435722 = y;
        double r435723 = sin(r435722);
        double r435724 = r435723 / r435722;
        double r435725 = r435721 * r435724;
        double r435726 = z;
        double r435727 = r435725 / r435726;
        return r435727;
}

double f(double x, double y, double z) {
        double r435728 = z;
        double r435729 = -3.3341519654404754e-26;
        bool r435730 = r435728 <= r435729;
        double r435731 = 2.042732523728719e+16;
        bool r435732 = r435728 <= r435731;
        double r435733 = !r435732;
        bool r435734 = r435730 || r435733;
        double r435735 = x;
        double r435736 = y;
        double r435737 = sin(r435736);
        double r435738 = r435737 / r435736;
        double r435739 = r435735 * r435738;
        double r435740 = r435739 / r435728;
        double r435741 = 1.0;
        double r435742 = r435735 * r435741;
        double r435743 = r435736 / r435737;
        double r435744 = r435728 * r435743;
        double r435745 = r435742 / r435744;
        double r435746 = r435734 ? r435740 : r435745;
        return r435746;
}

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.7
Target0.3
Herbie0.2
\[\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 2 regimes
  2. if z < -3.3341519654404754e-26 or 2.042732523728719e+16 < z

    1. Initial program 0.1

      \[\frac{x \cdot \frac{\sin y}{y}}{z}\]

    if -3.3341519654404754e-26 < z < 2.042732523728719e+16

    1. Initial program 5.9

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

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

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

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

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

Reproduce

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