Average Error: 2.6 → 0.2
Time: 15.0s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -73.32412333836710160994698526337742805481:\\ \;\;\;\;\frac{\frac{\sin y \cdot x}{y}}{z}\\ \mathbf{elif}\;x \le 81734465129316319031031597148521103360:\\ \;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\sin y \cdot x}{y}}{z}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;x \le -73.32412333836710160994698526337742805481:\\
\;\;\;\;\frac{\frac{\sin y \cdot x}{y}}{z}\\

\mathbf{elif}\;x \le 81734465129316319031031597148521103360:\\
\;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\

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

\end{array}
double f(double x, double y, double z) {
        double r17900755 = x;
        double r17900756 = y;
        double r17900757 = sin(r17900756);
        double r17900758 = r17900757 / r17900756;
        double r17900759 = r17900755 * r17900758;
        double r17900760 = z;
        double r17900761 = r17900759 / r17900760;
        return r17900761;
}

double f(double x, double y, double z) {
        double r17900762 = x;
        double r17900763 = -73.3241233383671;
        bool r17900764 = r17900762 <= r17900763;
        double r17900765 = y;
        double r17900766 = sin(r17900765);
        double r17900767 = r17900766 * r17900762;
        double r17900768 = r17900767 / r17900765;
        double r17900769 = z;
        double r17900770 = r17900768 / r17900769;
        double r17900771 = 8.173446512931632e+37;
        bool r17900772 = r17900762 <= r17900771;
        double r17900773 = r17900766 / r17900765;
        double r17900774 = r17900769 / r17900773;
        double r17900775 = r17900762 / r17900774;
        double r17900776 = r17900772 ? r17900775 : r17900770;
        double r17900777 = r17900764 ? r17900770 : r17900776;
        return r17900777;
}

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.2
\[\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 x < -73.3241233383671 or 8.173446512931632e+37 < x

    1. Initial program 0.2

      \[\frac{x \cdot \frac{\sin y}{y}}{z}\]
    2. Using strategy rm
    3. Applied div-inv0.4

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

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

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

    if -73.3241233383671 < x < 8.173446512931632e+37

    1. Initial program 4.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -73.32412333836710160994698526337742805481:\\ \;\;\;\;\frac{\frac{\sin y \cdot x}{y}}{z}\\ \mathbf{elif}\;x \le 81734465129316319031031597148521103360:\\ \;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\sin y \cdot x}{y}}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019171 +o rules:numerics
(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))