Average Error: 35.4 → 27.1
Time: 6.0s
Precision: 64
\[\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \le 4.57424434418995229:\\ \;\;\;\;\frac{\sqrt[3]{\tan \left(\frac{x}{y \cdot 2}\right)} \cdot \sqrt[3]{\tan \left(\frac{x}{y \cdot 2}\right)}}{\sqrt[3]{\sin \left(\frac{x}{y \cdot 2}\right)} \cdot \sqrt[3]{\sin \left(\frac{x}{y \cdot 2}\right)}} \cdot \frac{\sqrt[3]{\tan \left(\frac{x}{y \cdot 2}\right)}}{\sqrt[3]{\sin \left(\frac{x}{y \cdot 2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array}\]
\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)}
\begin{array}{l}
\mathbf{if}\;\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \le 4.57424434418995229:\\
\;\;\;\;\frac{\sqrt[3]{\tan \left(\frac{x}{y \cdot 2}\right)} \cdot \sqrt[3]{\tan \left(\frac{x}{y \cdot 2}\right)}}{\sqrt[3]{\sin \left(\frac{x}{y \cdot 2}\right)} \cdot \sqrt[3]{\sin \left(\frac{x}{y \cdot 2}\right)}} \cdot \frac{\sqrt[3]{\tan \left(\frac{x}{y \cdot 2}\right)}}{\sqrt[3]{\sin \left(\frac{x}{y \cdot 2}\right)}}\\

\mathbf{else}:\\
\;\;\;\;1\\

\end{array}
double f(double x, double y) {
        double r648243 = x;
        double r648244 = y;
        double r648245 = 2.0;
        double r648246 = r648244 * r648245;
        double r648247 = r648243 / r648246;
        double r648248 = tan(r648247);
        double r648249 = sin(r648247);
        double r648250 = r648248 / r648249;
        return r648250;
}

double f(double x, double y) {
        double r648251 = x;
        double r648252 = y;
        double r648253 = 2.0;
        double r648254 = r648252 * r648253;
        double r648255 = r648251 / r648254;
        double r648256 = tan(r648255);
        double r648257 = sin(r648255);
        double r648258 = r648256 / r648257;
        double r648259 = 4.574244344189952;
        bool r648260 = r648258 <= r648259;
        double r648261 = cbrt(r648256);
        double r648262 = r648261 * r648261;
        double r648263 = cbrt(r648257);
        double r648264 = r648263 * r648263;
        double r648265 = r648262 / r648264;
        double r648266 = r648261 / r648263;
        double r648267 = r648265 * r648266;
        double r648268 = 1.0;
        double r648269 = r648260 ? r648267 : r648268;
        return r648269;
}

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.4
Target28.4
Herbie27.1
\[\begin{array}{l} \mathbf{if}\;y \lt -1.23036909113069936 \cdot 10^{114}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \lt -9.1028524068119138 \cdot 10^{-222}:\\ \;\;\;\;\frac{\sin \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right) \cdot \log \left(e^{\cos \left(\frac{x}{y \cdot 2}\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (/ (tan (/ x (* y 2.0))) (sin (/ x (* y 2.0)))) < 4.574244344189952

    1. Initial program 25.6

      \[\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt26.3

      \[\leadsto \frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\color{blue}{\left(\sqrt[3]{\sin \left(\frac{x}{y \cdot 2}\right)} \cdot \sqrt[3]{\sin \left(\frac{x}{y \cdot 2}\right)}\right) \cdot \sqrt[3]{\sin \left(\frac{x}{y \cdot 2}\right)}}}\]
    4. Applied add-cube-cbrt25.6

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{\tan \left(\frac{x}{y \cdot 2}\right)} \cdot \sqrt[3]{\tan \left(\frac{x}{y \cdot 2}\right)}\right) \cdot \sqrt[3]{\tan \left(\frac{x}{y \cdot 2}\right)}}}{\left(\sqrt[3]{\sin \left(\frac{x}{y \cdot 2}\right)} \cdot \sqrt[3]{\sin \left(\frac{x}{y \cdot 2}\right)}\right) \cdot \sqrt[3]{\sin \left(\frac{x}{y \cdot 2}\right)}}\]
    5. Applied times-frac25.6

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

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

    1. Initial program 63.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \le 4.57424434418995229:\\ \;\;\;\;\frac{\sqrt[3]{\tan \left(\frac{x}{y \cdot 2}\right)} \cdot \sqrt[3]{\tan \left(\frac{x}{y \cdot 2}\right)}}{\sqrt[3]{\sin \left(\frac{x}{y \cdot 2}\right)} \cdot \sqrt[3]{\sin \left(\frac{x}{y \cdot 2}\right)}} \cdot \frac{\sqrt[3]{\tan \left(\frac{x}{y \cdot 2}\right)}}{\sqrt[3]{\sin \left(\frac{x}{y \cdot 2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array}\]

Reproduce

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

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

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