Average Error: 2.9 → 0.3
Time: 15.6s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -63423026121534586243447259136:\\ \;\;\;\;\frac{\frac{1}{\frac{y}{\sin y}} \cdot x}{z}\\ \mathbf{elif}\;x \le 8.079582008954303854545151585771577035848 \cdot 10^{61}:\\ \;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\frac{y}{\sin y \cdot x}}}{z}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;x \le -63423026121534586243447259136:\\
\;\;\;\;\frac{\frac{1}{\frac{y}{\sin y}} \cdot x}{z}\\

\mathbf{elif}\;x \le 8.079582008954303854545151585771577035848 \cdot 10^{61}:\\
\;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\

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

\end{array}
double f(double x, double y, double z) {
        double r21942031 = x;
        double r21942032 = y;
        double r21942033 = sin(r21942032);
        double r21942034 = r21942033 / r21942032;
        double r21942035 = r21942031 * r21942034;
        double r21942036 = z;
        double r21942037 = r21942035 / r21942036;
        return r21942037;
}

double f(double x, double y, double z) {
        double r21942038 = x;
        double r21942039 = -6.342302612153459e+28;
        bool r21942040 = r21942038 <= r21942039;
        double r21942041 = 1.0;
        double r21942042 = y;
        double r21942043 = sin(r21942042);
        double r21942044 = r21942042 / r21942043;
        double r21942045 = r21942041 / r21942044;
        double r21942046 = r21942045 * r21942038;
        double r21942047 = z;
        double r21942048 = r21942046 / r21942047;
        double r21942049 = 8.079582008954304e+61;
        bool r21942050 = r21942038 <= r21942049;
        double r21942051 = r21942043 / r21942042;
        double r21942052 = r21942047 / r21942051;
        double r21942053 = r21942038 / r21942052;
        double r21942054 = r21942043 * r21942038;
        double r21942055 = r21942042 / r21942054;
        double r21942056 = r21942041 / r21942055;
        double r21942057 = r21942056 / r21942047;
        double r21942058 = r21942050 ? r21942053 : r21942057;
        double r21942059 = r21942040 ? r21942048 : r21942058;
        return r21942059;
}

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.9
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 3 regimes
  2. if x < -6.342302612153459e+28

    1. Initial program 0.2

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

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

      \[\leadsto \color{blue}{\frac{\frac{x \cdot \frac{\sin y}{y}}{1}}{z}}\]
    5. Simplified0.2

      \[\leadsto \frac{\color{blue}{\frac{x}{\frac{y}{\sin y}}}}{z}\]
    6. Using strategy rm
    7. Applied div-inv0.3

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

    if -6.342302612153459e+28 < x < 8.079582008954304e+61

    1. Initial program 4.5

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

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

    if 8.079582008954304e+61 < x

    1. Initial program 0.2

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

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

      \[\leadsto \color{blue}{\frac{\frac{x \cdot \frac{\sin y}{y}}{1}}{z}}\]
    5. Simplified0.3

      \[\leadsto \frac{\color{blue}{\frac{x}{\frac{y}{\sin y}}}}{z}\]
    6. Using strategy rm
    7. Applied div-inv0.4

      \[\leadsto \frac{\frac{x}{\color{blue}{y \cdot \frac{1}{\sin y}}}}{z}\]
    8. Using strategy rm
    9. Applied clear-num0.5

      \[\leadsto \frac{\color{blue}{\frac{1}{\frac{y \cdot \frac{1}{\sin y}}{x}}}}{z}\]
    10. Simplified0.4

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

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

Reproduce

herbie shell --seed 2019192 
(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))