Average Error: 2.8 → 0.5
Time: 12.6s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.558037767913342817643933364747126420158 \cdot 10^{92} \lor \neg \left(z \le 5.039220706859192027751049543236769960828 \cdot 10^{68}\right):\\ \;\;\;\;\frac{x}{\frac{y}{\sin y}} \cdot \frac{1}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;z \le -1.558037767913342817643933364747126420158 \cdot 10^{92} \lor \neg \left(z \le 5.039220706859192027751049543236769960828 \cdot 10^{68}\right):\\
\;\;\;\;\frac{x}{\frac{y}{\sin y}} \cdot \frac{1}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r1642774 = x;
        double r1642775 = y;
        double r1642776 = sin(r1642775);
        double r1642777 = r1642776 / r1642775;
        double r1642778 = r1642774 * r1642777;
        double r1642779 = z;
        double r1642780 = r1642778 / r1642779;
        return r1642780;
}

double f(double x, double y, double z) {
        double r1642781 = z;
        double r1642782 = -1.5580377679133428e+92;
        bool r1642783 = r1642781 <= r1642782;
        double r1642784 = 5.039220706859192e+68;
        bool r1642785 = r1642781 <= r1642784;
        double r1642786 = !r1642785;
        bool r1642787 = r1642783 || r1642786;
        double r1642788 = x;
        double r1642789 = y;
        double r1642790 = sin(r1642789);
        double r1642791 = r1642789 / r1642790;
        double r1642792 = r1642788 / r1642791;
        double r1642793 = 1.0;
        double r1642794 = r1642793 / r1642781;
        double r1642795 = r1642792 * r1642794;
        double r1642796 = r1642790 / r1642789;
        double r1642797 = r1642781 / r1642796;
        double r1642798 = r1642788 / r1642797;
        double r1642799 = r1642787 ? r1642795 : r1642798;
        return r1642799;
}

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.3
Herbie0.5
\[\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 z < -1.5580377679133428e+92 or 5.039220706859192e+68 < z

    1. Initial program 0.1

      \[\frac{x \cdot \frac{\sin y}{y}}{z}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity0.1

      \[\leadsto \frac{x \cdot \frac{\sin y}{y}}{\color{blue}{1 \cdot z}}\]
    4. Applied times-frac6.0

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

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

      \[\leadsto x \cdot \frac{\color{blue}{\frac{1}{\frac{y}{\sin y}}}}{z}\]
    8. Using strategy rm
    9. Applied div-inv6.0

      \[\leadsto x \cdot \color{blue}{\left(\frac{1}{\frac{y}{\sin y}} \cdot \frac{1}{z}\right)}\]
    10. Applied associate-*r*0.2

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

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

    if -1.5580377679133428e+92 < z < 5.039220706859192e+68

    1. Initial program 4.5

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

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

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

Reproduce

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