Average Error: 2.8 → 0.2
Time: 7.2s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot \frac{\sin y}{y} \le -2.631506410722672164338420206087803523502 \cdot 10^{-268} \lor \neg \left(x \cdot \frac{\sin y}{y} \le 3.806735042526462495596402093270349111849 \cdot 10^{-223}\right):\\ \;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{\sin y}{y}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot \frac{\sin y}{y} \le -2.631506410722672164338420206087803523502 \cdot 10^{-268} \lor \neg \left(x \cdot \frac{\sin y}{y} \le 3.806735042526462495596402093270349111849 \cdot 10^{-223}\right):\\
\;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r507378 = x;
        double r507379 = y;
        double r507380 = sin(r507379);
        double r507381 = r507380 / r507379;
        double r507382 = r507378 * r507381;
        double r507383 = z;
        double r507384 = r507382 / r507383;
        return r507384;
}

double f(double x, double y, double z) {
        double r507385 = x;
        double r507386 = y;
        double r507387 = sin(r507386);
        double r507388 = r507387 / r507386;
        double r507389 = r507385 * r507388;
        double r507390 = -2.631506410722672e-268;
        bool r507391 = r507389 <= r507390;
        double r507392 = 3.8067350425264625e-223;
        bool r507393 = r507389 <= r507392;
        double r507394 = !r507393;
        bool r507395 = r507391 || r507394;
        double r507396 = z;
        double r507397 = r507389 / r507396;
        double r507398 = r507385 / r507396;
        double r507399 = r507398 * r507388;
        double r507400 = r507395 ? r507397 : r507399;
        return r507400;
}

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.8
Target0.4
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 (/ (sin y) y)) < -2.631506410722672e-268 or 3.8067350425264625e-223 < (* x (/ (sin y) y))

    1. Initial program 0.2

      \[\frac{x \cdot \frac{\sin y}{y}}{z}\]

    if -2.631506410722672e-268 < (* x (/ (sin y) y)) < 3.8067350425264625e-223

    1. Initial program 10.7

      \[\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}}}}\]
    4. Using strategy rm
    5. Applied associate-/r/0.2

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

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

Reproduce

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

  :herbie-target
  (if (< z -4.21737202034271466e-29) (/ (* x (/ 1 (/ y (sin y)))) z) (if (< z 4.44670236911381103e64) (/ x (* z (/ y (sin y)))) (/ (* x (/ 1 (/ y (sin y)))) z)))

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