Average Error: 2.7 → 1.8
Time: 13.8s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le 3.883506706037952 \cdot 10^{-64}:\\ \;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{z}{x \cdot \frac{\sin y}{y}}}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;x \le 3.883506706037952 \cdot 10^{-64}:\\
\;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\

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

\end{array}
double f(double x, double y, double z) {
        double r21068787 = x;
        double r21068788 = y;
        double r21068789 = sin(r21068788);
        double r21068790 = r21068789 / r21068788;
        double r21068791 = r21068787 * r21068790;
        double r21068792 = z;
        double r21068793 = r21068791 / r21068792;
        return r21068793;
}

double f(double x, double y, double z) {
        double r21068794 = x;
        double r21068795 = 3.883506706037952e-64;
        bool r21068796 = r21068794 <= r21068795;
        double r21068797 = z;
        double r21068798 = y;
        double r21068799 = sin(r21068798);
        double r21068800 = r21068799 / r21068798;
        double r21068801 = r21068797 / r21068800;
        double r21068802 = r21068794 / r21068801;
        double r21068803 = 1.0;
        double r21068804 = r21068794 * r21068800;
        double r21068805 = r21068797 / r21068804;
        double r21068806 = r21068803 / r21068805;
        double r21068807 = r21068796 ? r21068802 : r21068806;
        return r21068807;
}

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
Herbie1.8
\[\begin{array}{l} \mathbf{if}\;z \lt -4.2173720203427147 \cdot 10^{-29}:\\ \;\;\;\;\frac{x \cdot \frac{1}{\frac{y}{\sin y}}}{z}\\ \mathbf{elif}\;z \lt 4.446702369113811 \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 x < 3.883506706037952e-64

    1. Initial program 3.7

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

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

    if 3.883506706037952e-64 < x

    1. Initial program 0.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 3.883506706037952 \cdot 10^{-64}:\\ \;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{z}{x \cdot \frac{\sin y}{y}}}\\ \end{array}\]

Reproduce

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

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