Average Error: 2.7 → 0.2
Time: 17.8s
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 r356160 = x;
        double r356161 = y;
        double r356162 = sin(r356161);
        double r356163 = r356162 / r356161;
        double r356164 = r356160 * r356163;
        double r356165 = z;
        double r356166 = r356164 / r356165;
        return r356166;
}

double f(double x, double y, double z) {
        double r356167 = x;
        double r356168 = y;
        double r356169 = sin(r356168);
        double r356170 = r356169 / r356168;
        double r356171 = r356167 * r356170;
        double r356172 = -3.4978427305892834e-231;
        bool r356173 = r356171 <= r356172;
        double r356174 = 6.641146027642848e-283;
        bool r356175 = r356171 <= r356174;
        double r356176 = !r356175;
        bool r356177 = r356173 || r356176;
        double r356178 = z;
        double r356179 = r356171 / r356178;
        double r356180 = r356169 / r356178;
        double r356181 = r356168 / r356180;
        double r356182 = r356167 / r356181;
        double r356183 = r356177 ? r356179 : r356182;
        return r356183;
}

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 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))