Average Error: 2.6 → 0.7
Time: 16.3s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.6132281232836582 \cdot 10^{177} \lor \neg \left(z \le 99581.014851795189\right):\\ \;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;z \le -2.6132281232836582 \cdot 10^{177} \lor \neg \left(z \le 99581.014851795189\right):\\
\;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r321825 = x;
        double r321826 = y;
        double r321827 = sin(r321826);
        double r321828 = r321827 / r321826;
        double r321829 = r321825 * r321828;
        double r321830 = z;
        double r321831 = r321829 / r321830;
        return r321831;
}

double f(double x, double y, double z) {
        double r321832 = z;
        double r321833 = -2.613228123283658e+177;
        bool r321834 = r321832 <= r321833;
        double r321835 = 99581.01485179519;
        bool r321836 = r321832 <= r321835;
        double r321837 = !r321836;
        bool r321838 = r321834 || r321837;
        double r321839 = x;
        double r321840 = y;
        double r321841 = sin(r321840);
        double r321842 = r321841 / r321840;
        double r321843 = r321839 * r321842;
        double r321844 = r321843 / r321832;
        double r321845 = r321832 / r321842;
        double r321846 = r321839 / r321845;
        double r321847 = r321838 ? r321844 : r321846;
        return r321847;
}

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.7
\[\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 < -2.613228123283658e+177 or 99581.01485179519 < z

    1. Initial program 0.1

      \[\frac{x \cdot \frac{\sin y}{y}}{z}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity0.1

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

    if -2.613228123283658e+177 < z < 99581.01485179519

    1. Initial program 4.1

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

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

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

Reproduce

herbie shell --seed 2019198 
(FPCore (x y z)
  :name "Linear.Quaternion:$ctanh from linear-1.19.1.3"

  :herbie-target
  (if (< z -4.2173720203427147e-29) (/ (* x (/ 1.0 (/ y (sin y)))) z) (if (< z 4.446702369113811e+64) (/ x (* z (/ y (sin y)))) (/ (* x (/ 1.0 (/ y (sin y)))) z)))

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