Average Error: 2.6 → 0.3
Time: 6.0s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.07914030231644789 \cdot 10^{32} \lor \neg \left(z \le 9.91958923133224245 \cdot 10^{38}\right):\\ \;\;\;\;\left(x \cdot \frac{\sin y}{y}\right) \cdot \frac{1}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z \cdot \frac{y}{\sin y}}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;z \le -1.07914030231644789 \cdot 10^{32} \lor \neg \left(z \le 9.91958923133224245 \cdot 10^{38}\right):\\
\;\;\;\;\left(x \cdot \frac{\sin y}{y}\right) \cdot \frac{1}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r473477 = x;
        double r473478 = y;
        double r473479 = sin(r473478);
        double r473480 = r473479 / r473478;
        double r473481 = r473477 * r473480;
        double r473482 = z;
        double r473483 = r473481 / r473482;
        return r473483;
}

double f(double x, double y, double z) {
        double r473484 = z;
        double r473485 = -1.0791403023164479e+32;
        bool r473486 = r473484 <= r473485;
        double r473487 = 9.919589231332242e+38;
        bool r473488 = r473484 <= r473487;
        double r473489 = !r473488;
        bool r473490 = r473486 || r473489;
        double r473491 = x;
        double r473492 = y;
        double r473493 = sin(r473492);
        double r473494 = r473493 / r473492;
        double r473495 = r473491 * r473494;
        double r473496 = 1.0;
        double r473497 = r473496 / r473484;
        double r473498 = r473495 * r473497;
        double r473499 = r473492 / r473493;
        double r473500 = r473484 * r473499;
        double r473501 = r473491 / r473500;
        double r473502 = r473490 ? r473498 : r473501;
        return r473502;
}

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.3
\[\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 < -1.0791403023164479e+32 or 9.919589231332242e+38 < z

    1. Initial program 0.1

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

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

    if -1.0791403023164479e+32 < z < 9.919589231332242e+38

    1. Initial program 4.9

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

      \[\leadsto \frac{x \cdot \color{blue}{\frac{1}{\frac{y}{\sin y}}}}{z}\]
    4. Using strategy rm
    5. Applied associate-/l*0.3

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

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

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

Reproduce

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