Average Error: 35.2 → 27.3
Time: 19.9s
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{\tan \left(\frac{x}{2.0 \cdot y}\right)}{\sin \left(\frac{x}{2.0 \cdot y}\right)} \le 2.551995579119875:\\ \;\;\;\;\frac{\tan \left(\frac{x}{2.0 \cdot y}\right)}{\sin \left(0.5 \cdot \frac{x}{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{\tan \left(\frac{x}{2.0 \cdot y}\right)}{\sin \left(\frac{x}{2.0 \cdot y}\right)} \le 2.551995579119875:\\
\;\;\;\;\frac{\tan \left(\frac{x}{2.0 \cdot y}\right)}{\sin \left(0.5 \cdot \frac{x}{y}\right)}\\

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

\end{array}
double f(double x, double y) {
        double r34469822 = x;
        double r34469823 = y;
        double r34469824 = 2.0;
        double r34469825 = r34469823 * r34469824;
        double r34469826 = r34469822 / r34469825;
        double r34469827 = tan(r34469826);
        double r34469828 = sin(r34469826);
        double r34469829 = r34469827 / r34469828;
        return r34469829;
}

double f(double x, double y) {
        double r34469830 = x;
        double r34469831 = 2.0;
        double r34469832 = y;
        double r34469833 = r34469831 * r34469832;
        double r34469834 = r34469830 / r34469833;
        double r34469835 = tan(r34469834);
        double r34469836 = sin(r34469834);
        double r34469837 = r34469835 / r34469836;
        double r34469838 = 2.551995579119875;
        bool r34469839 = r34469837 <= r34469838;
        double r34469840 = 0.5;
        double r34469841 = r34469830 / r34469832;
        double r34469842 = r34469840 * r34469841;
        double r34469843 = sin(r34469842);
        double r34469844 = r34469835 / r34469843;
        double r34469845 = 1.0;
        double r34469846 = r34469839 ? r34469844 : r34469845;
        return r34469846;
}

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.2
Target28.4
Herbie27.3
\[\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 (/ (tan (/ x (* y 2.0))) (sin (/ x (* y 2.0)))) < 2.551995579119875

    1. Initial program 24.7

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

      \[\leadsto \frac{\tan \left(\frac{x}{y \cdot 2.0}\right)}{\sin \color{blue}{\left(0.5 \cdot \frac{x}{y}\right)}}\]

    if 2.551995579119875 < (/ (tan (/ x (* y 2.0))) (sin (/ x (* y 2.0))))

    1. Initial program 61.5

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

      \[\leadsto \color{blue}{1.0}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification27.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\tan \left(\frac{x}{2.0 \cdot y}\right)}{\sin \left(\frac{x}{2.0 \cdot y}\right)} \le 2.551995579119875:\\ \;\;\;\;\frac{\tan \left(\frac{x}{2.0 \cdot y}\right)}{\sin \left(0.5 \cdot \frac{x}{y}\right)}\\ \mathbf{else}:\\ \;\;\;\;1.0\\ \end{array}\]

Reproduce

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