Average Error: 35.3 → 28.4
Time: 24.3s
Precision: 64
\[\frac{\tan \left(\frac{x}{y \cdot 2.0}\right)}{\sin \left(\frac{x}{y \cdot 2.0}\right)}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x}{2.0 \cdot y} \le 4.3945246018946 \cdot 10^{-310}:\\ \;\;\;\;1.0\\ \mathbf{elif}\;\frac{x}{2.0 \cdot y} \le 5.725300019950944 \cdot 10^{+237}:\\ \;\;\;\;\frac{\sin \left(\frac{x}{2.0 \cdot y}\right)}{\sin \left(\frac{x}{2.0 \cdot y}\right) \cdot \cos \left(\frac{x}{2.0 \cdot y}\right)}\\ \mathbf{else}:\\ \;\;\;\;1.0\\ \end{array}\]
\frac{\tan \left(\frac{x}{y \cdot 2.0}\right)}{\sin \left(\frac{x}{y \cdot 2.0}\right)}
\begin{array}{l}
\mathbf{if}\;\frac{x}{2.0 \cdot y} \le 4.3945246018946 \cdot 10^{-310}:\\
\;\;\;\;1.0\\

\mathbf{elif}\;\frac{x}{2.0 \cdot y} \le 5.725300019950944 \cdot 10^{+237}:\\
\;\;\;\;\frac{\sin \left(\frac{x}{2.0 \cdot y}\right)}{\sin \left(\frac{x}{2.0 \cdot y}\right) \cdot \cos \left(\frac{x}{2.0 \cdot y}\right)}\\

\mathbf{else}:\\
\;\;\;\;1.0\\

\end{array}
double f(double x, double y) {
        double r33015973 = x;
        double r33015974 = y;
        double r33015975 = 2.0;
        double r33015976 = r33015974 * r33015975;
        double r33015977 = r33015973 / r33015976;
        double r33015978 = tan(r33015977);
        double r33015979 = sin(r33015977);
        double r33015980 = r33015978 / r33015979;
        return r33015980;
}

double f(double x, double y) {
        double r33015981 = x;
        double r33015982 = 2.0;
        double r33015983 = y;
        double r33015984 = r33015982 * r33015983;
        double r33015985 = r33015981 / r33015984;
        double r33015986 = 4.3945246018946e-310;
        bool r33015987 = r33015985 <= r33015986;
        double r33015988 = 1.0;
        double r33015989 = 5.725300019950944e+237;
        bool r33015990 = r33015985 <= r33015989;
        double r33015991 = sin(r33015985);
        double r33015992 = cos(r33015985);
        double r33015993 = r33015991 * r33015992;
        double r33015994 = r33015991 / r33015993;
        double r33015995 = r33015990 ? r33015994 : r33015988;
        double r33015996 = r33015987 ? r33015988 : r33015995;
        return r33015996;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original35.3
Target29.4
Herbie28.4
\[\begin{array}{l} \mathbf{if}\;y \lt -1.2303690911306994 \cdot 10^{+114}:\\ \;\;\;\;1.0\\ \mathbf{elif}\;y \lt -9.102852406811914 \cdot 10^{-222}:\\ \;\;\;\;\frac{\sin \left(\frac{x}{y \cdot 2.0}\right)}{\sin \left(\frac{x}{y \cdot 2.0}\right) \cdot \log \left(e^{\cos \left(\frac{x}{y \cdot 2.0}\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;1.0\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (/ x (* y 2.0)) < 4.3945246018946e-310 or 5.725300019950944e+237 < (/ x (* y 2.0))

    1. Initial program 41.0

      \[\frac{\tan \left(\frac{x}{y \cdot 2.0}\right)}{\sin \left(\frac{x}{y \cdot 2.0}\right)}\]
    2. Taylor expanded around 0 30.5

      \[\leadsto \color{blue}{1.0}\]

    if 4.3945246018946e-310 < (/ x (* y 2.0)) < 5.725300019950944e+237

    1. Initial program 24.5

      \[\frac{\tan \left(\frac{x}{y \cdot 2.0}\right)}{\sin \left(\frac{x}{y \cdot 2.0}\right)}\]
    2. Using strategy rm
    3. Applied tan-quot24.5

      \[\leadsto \frac{\color{blue}{\frac{\sin \left(\frac{x}{y \cdot 2.0}\right)}{\cos \left(\frac{x}{y \cdot 2.0}\right)}}}{\sin \left(\frac{x}{y \cdot 2.0}\right)}\]
    4. Using strategy rm
    5. Applied associate-/l/24.5

      \[\leadsto \color{blue}{\frac{\sin \left(\frac{x}{y \cdot 2.0}\right)}{\sin \left(\frac{x}{y \cdot 2.0}\right) \cdot \cos \left(\frac{x}{y \cdot 2.0}\right)}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification28.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{2.0 \cdot y} \le 4.3945246018946 \cdot 10^{-310}:\\ \;\;\;\;1.0\\ \mathbf{elif}\;\frac{x}{2.0 \cdot y} \le 5.725300019950944 \cdot 10^{+237}:\\ \;\;\;\;\frac{\sin \left(\frac{x}{2.0 \cdot y}\right)}{\sin \left(\frac{x}{2.0 \cdot y}\right) \cdot \cos \left(\frac{x}{2.0 \cdot y}\right)}\\ \mathbf{else}:\\ \;\;\;\;1.0\\ \end{array}\]

Reproduce

herbie shell --seed 2019162 +o rules:numerics
(FPCore (x y)
  :name "Diagrams.TwoD.Layout.CirclePacking:approxRadius from diagrams-contrib-1.3.0.5"

  :herbie-target
  (if (< y -1.2303690911306994e+114) 1.0 (if (< y -9.102852406811914e-222) (/ (sin (/ x (* y 2.0))) (* (sin (/ x (* y 2.0))) (log (exp (cos (/ x (* y 2.0))))))) 1.0))

  (/ (tan (/ x (* y 2.0))) (sin (/ x (* y 2.0)))))