Average Error: 35.2 → 27.5
Time: 14.7s
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 16.799894871361925:\\ \;\;\;\;\left(\sqrt[3]{\frac{\tan \left(\frac{x}{2.0 \cdot y}\right)}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin \left(\frac{x}{2.0 \cdot y}\right)\right)\right)}} \cdot \sqrt[3]{\frac{\tan \left(\frac{x}{2.0 \cdot y}\right)}{\sin \left(\frac{x}{2.0 \cdot y}\right)}}\right) \cdot \sqrt[3]{\frac{\tan \left(\frac{x}{2.0 \cdot y}\right)}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin \left(\frac{x}{2.0 \cdot y}\right)\right)\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 16.799894871361925:\\
\;\;\;\;\left(\sqrt[3]{\frac{\tan \left(\frac{x}{2.0 \cdot y}\right)}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin \left(\frac{x}{2.0 \cdot y}\right)\right)\right)}} \cdot \sqrt[3]{\frac{\tan \left(\frac{x}{2.0 \cdot y}\right)}{\sin \left(\frac{x}{2.0 \cdot y}\right)}}\right) \cdot \sqrt[3]{\frac{\tan \left(\frac{x}{2.0 \cdot y}\right)}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin \left(\frac{x}{2.0 \cdot y}\right)\right)\right)}}\\

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

\end{array}
double f(double x, double y) {
        double r11090109 = x;
        double r11090110 = y;
        double r11090111 = 2.0;
        double r11090112 = r11090110 * r11090111;
        double r11090113 = r11090109 / r11090112;
        double r11090114 = tan(r11090113);
        double r11090115 = sin(r11090113);
        double r11090116 = r11090114 / r11090115;
        return r11090116;
}

double f(double x, double y) {
        double r11090117 = x;
        double r11090118 = 2.0;
        double r11090119 = y;
        double r11090120 = r11090118 * r11090119;
        double r11090121 = r11090117 / r11090120;
        double r11090122 = tan(r11090121);
        double r11090123 = sin(r11090121);
        double r11090124 = r11090122 / r11090123;
        double r11090125 = 16.799894871361925;
        bool r11090126 = r11090124 <= r11090125;
        double r11090127 = expm1(r11090123);
        double r11090128 = log1p(r11090127);
        double r11090129 = r11090122 / r11090128;
        double r11090130 = cbrt(r11090129);
        double r11090131 = cbrt(r11090124);
        double r11090132 = r11090130 * r11090131;
        double r11090133 = r11090132 * r11090130;
        double r11090134 = 1.0;
        double r11090135 = r11090126 ? r11090133 : r11090134;
        return r11090135;
}

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.9
Herbie27.5
\[\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)))) < 16.799894871361925

    1. Initial program 26.4

      \[\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 add-cube-cbrt26.4

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{\tan \left(\frac{x}{y \cdot 2.0}\right)}{\sin \left(\frac{x}{y \cdot 2.0}\right)}} \cdot \sqrt[3]{\frac{\tan \left(\frac{x}{y \cdot 2.0}\right)}{\sin \left(\frac{x}{y \cdot 2.0}\right)}}\right) \cdot \sqrt[3]{\frac{\tan \left(\frac{x}{y \cdot 2.0}\right)}{\sin \left(\frac{x}{y \cdot 2.0}\right)}}}\]
    4. Using strategy rm
    5. Applied log1p-expm1-u26.4

      \[\leadsto \left(\sqrt[3]{\frac{\tan \left(\frac{x}{y \cdot 2.0}\right)}{\sin \left(\frac{x}{y \cdot 2.0}\right)}} \cdot \sqrt[3]{\frac{\tan \left(\frac{x}{y \cdot 2.0}\right)}{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin \left(\frac{x}{y \cdot 2.0}\right)\right)\right)}}}\right) \cdot \sqrt[3]{\frac{\tan \left(\frac{x}{y \cdot 2.0}\right)}{\sin \left(\frac{x}{y \cdot 2.0}\right)}}\]
    6. Using strategy rm
    7. Applied log1p-expm1-u26.4

      \[\leadsto \left(\sqrt[3]{\frac{\tan \left(\frac{x}{y \cdot 2.0}\right)}{\sin \left(\frac{x}{y \cdot 2.0}\right)}} \cdot \sqrt[3]{\frac{\tan \left(\frac{x}{y \cdot 2.0}\right)}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin \left(\frac{x}{y \cdot 2.0}\right)\right)\right)}}\right) \cdot \sqrt[3]{\frac{\tan \left(\frac{x}{y \cdot 2.0}\right)}{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin \left(\frac{x}{y \cdot 2.0}\right)\right)\right)}}}\]

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

    1. Initial program 62.2

      \[\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.8

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

    \[\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 16.799894871361925:\\ \;\;\;\;\left(\sqrt[3]{\frac{\tan \left(\frac{x}{2.0 \cdot y}\right)}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin \left(\frac{x}{2.0 \cdot y}\right)\right)\right)}} \cdot \sqrt[3]{\frac{\tan \left(\frac{x}{2.0 \cdot y}\right)}{\sin \left(\frac{x}{2.0 \cdot y}\right)}}\right) \cdot \sqrt[3]{\frac{\tan \left(\frac{x}{2.0 \cdot y}\right)}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin \left(\frac{x}{2.0 \cdot y}\right)\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;1.0\\ \end{array}\]

Reproduce

herbie shell --seed 2019156 +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)))))