Average Error: 2.7 → 0.2
Time: 17.2s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot \frac{\sin y}{y} \le -3.497842730589283443253731648215616723861 \cdot 10^{-231} \lor \neg \left(x \cdot \frac{\sin y}{y} \le 6.641146027642848148772445195187677057815 \cdot 10^{-283}\right):\\ \;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{y}{\frac{\sin y}{z}}}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot \frac{\sin y}{y} \le -3.497842730589283443253731648215616723861 \cdot 10^{-231} \lor \neg \left(x \cdot \frac{\sin y}{y} \le 6.641146027642848148772445195187677057815 \cdot 10^{-283}\right):\\
\;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r435193 = x;
        double r435194 = y;
        double r435195 = sin(r435194);
        double r435196 = r435195 / r435194;
        double r435197 = r435193 * r435196;
        double r435198 = z;
        double r435199 = r435197 / r435198;
        return r435199;
}

double f(double x, double y, double z) {
        double r435200 = x;
        double r435201 = y;
        double r435202 = sin(r435201);
        double r435203 = r435202 / r435201;
        double r435204 = r435200 * r435203;
        double r435205 = -3.4978427305892834e-231;
        bool r435206 = r435204 <= r435205;
        double r435207 = 6.641146027642848e-283;
        bool r435208 = r435204 <= r435207;
        double r435209 = !r435208;
        bool r435210 = r435206 || r435209;
        double r435211 = z;
        double r435212 = r435204 / r435211;
        double r435213 = r435202 / r435211;
        double r435214 = r435201 / r435213;
        double r435215 = r435200 / r435214;
        double r435216 = r435210 ? r435212 : r435215;
        return r435216;
}

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.7
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 (/ (sin y) y)) < -3.4978427305892834e-231 or 6.641146027642848e-283 < (* x (/ (sin y) y))

    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 times-frac3.6

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

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

      \[\leadsto x \cdot \color{blue}{\left(\frac{\sin y}{y} \cdot \frac{1}{z}\right)}\]
    8. Using strategy rm
    9. Applied un-div-inv3.6

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

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

    if -3.4978427305892834e-231 < (* x (/ (sin y) y)) < 6.641146027642848e-283

    1. Initial program 11.2

      \[\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}}}}\]
    4. Simplified0.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot \frac{\sin y}{y} \le -3.497842730589283443253731648215616723861 \cdot 10^{-231} \lor \neg \left(x \cdot \frac{\sin y}{y} \le 6.641146027642848148772445195187677057815 \cdot 10^{-283}\right):\\ \;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{y}{\frac{\sin y}{z}}}\\ \end{array}\]

Reproduce

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