Average Error: 2.6 → 1.0
Time: 5.4s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.8568993598992816 \cdot 10^{48} \lor \neg \left(z \le 1.34045888132617558 \cdot 10^{-169}\right):\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{1}{\frac{\sin y}{y}}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{\frac{\sin y}{z}}{y}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;z \le -2.8568993598992816 \cdot 10^{48} \lor \neg \left(z \le 1.34045888132617558 \cdot 10^{-169}\right):\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{1}{\frac{\sin y}{y}}}\\

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

\end{array}
double f(double x, double y, double z) {
        double r466030 = x;
        double r466031 = y;
        double r466032 = sin(r466031);
        double r466033 = r466032 / r466031;
        double r466034 = r466030 * r466033;
        double r466035 = z;
        double r466036 = r466034 / r466035;
        return r466036;
}

double f(double x, double y, double z) {
        double r466037 = z;
        double r466038 = -2.8568993598992816e+48;
        bool r466039 = r466037 <= r466038;
        double r466040 = 1.3404588813261756e-169;
        bool r466041 = r466037 <= r466040;
        double r466042 = !r466041;
        bool r466043 = r466039 || r466042;
        double r466044 = x;
        double r466045 = r466044 / r466037;
        double r466046 = 1.0;
        double r466047 = y;
        double r466048 = sin(r466047);
        double r466049 = r466048 / r466047;
        double r466050 = r466046 / r466049;
        double r466051 = r466045 / r466050;
        double r466052 = r466048 / r466037;
        double r466053 = r466052 / r466047;
        double r466054 = r466044 * r466053;
        double r466055 = r466043 ? r466051 : r466054;
        return r466055;
}

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
Herbie1.0
\[\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.8568993598992816e+48 or 1.3404588813261756e-169 < z

    1. Initial program 0.8

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\frac{\sin y}{y}}}}\]
    4. Using strategy rm
    5. Applied div-inv4.3

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

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

    if -2.8568993598992816e+48 < z < 1.3404588813261756e-169

    1. Initial program 6.0

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

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

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

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

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

Reproduce

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