Average Error: 35.7 → 28.4
Time: 20.2s
Precision: 64
\[\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)}\]
\[\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{\sqrt[3]{\left(\cos \left(\frac{x}{y \cdot 2}\right) \cdot \cos \left(\frac{x}{y \cdot 2}\right)\right) \cdot \cos \left(\frac{x}{y \cdot 2}\right)}}\right)\right)\]
\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)}
\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{\sqrt[3]{\left(\cos \left(\frac{x}{y \cdot 2}\right) \cdot \cos \left(\frac{x}{y \cdot 2}\right)\right) \cdot \cos \left(\frac{x}{y \cdot 2}\right)}}\right)\right)
double f(double x, double y) {
        double r42279565 = x;
        double r42279566 = y;
        double r42279567 = 2.0;
        double r42279568 = r42279566 * r42279567;
        double r42279569 = r42279565 / r42279568;
        double r42279570 = tan(r42279569);
        double r42279571 = sin(r42279569);
        double r42279572 = r42279570 / r42279571;
        return r42279572;
}

double f(double x, double y) {
        double r42279573 = 1.0;
        double r42279574 = x;
        double r42279575 = y;
        double r42279576 = 2.0;
        double r42279577 = r42279575 * r42279576;
        double r42279578 = r42279574 / r42279577;
        double r42279579 = cos(r42279578);
        double r42279580 = r42279579 * r42279579;
        double r42279581 = r42279580 * r42279579;
        double r42279582 = cbrt(r42279581);
        double r42279583 = r42279573 / r42279582;
        double r42279584 = expm1(r42279583);
        double r42279585 = log1p(r42279584);
        return r42279585;
}

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.7
Target28.8
Herbie28.4
\[\begin{array}{l} \mathbf{if}\;y \lt -1.230369091130699363447511617672816900781 \cdot 10^{114}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \lt -9.102852406811913849731222630299032206502 \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. Initial program 35.7

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

    \[\leadsto \frac{\color{blue}{\frac{\sin \left(\frac{x}{y \cdot 2}\right)}{\cos \left(\frac{x}{y \cdot 2}\right)}}}{\sin \left(\frac{x}{y \cdot 2}\right)}\]
  4. Applied associate-/l/35.7

    \[\leadsto \color{blue}{\frac{\sin \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right) \cdot \cos \left(\frac{x}{y \cdot 2}\right)}}\]
  5. Using strategy rm
  6. Applied log1p-expm1-u35.8

    \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\sin \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right) \cdot \cos \left(\frac{x}{y \cdot 2}\right)}\right)\right)}\]
  7. Simplified28.4

    \[\leadsto \mathsf{log1p}\left(\color{blue}{\mathsf{expm1}\left(\frac{1}{\cos \left(\frac{x}{y \cdot 2}\right)}\right)}\right)\]
  8. Using strategy rm
  9. Applied add-cbrt-cube28.4

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{\color{blue}{\sqrt[3]{\left(\cos \left(\frac{x}{y \cdot 2}\right) \cdot \cos \left(\frac{x}{y \cdot 2}\right)\right) \cdot \cos \left(\frac{x}{y \cdot 2}\right)}}}\right)\right)\]
  10. Final simplification28.4

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{\sqrt[3]{\left(\cos \left(\frac{x}{y \cdot 2}\right) \cdot \cos \left(\frac{x}{y \cdot 2}\right)\right) \cdot \cos \left(\frac{x}{y \cdot 2}\right)}}\right)\right)\]

Reproduce

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