Average Error: 27.8 → 4.4
Time: 40.5s
Precision: 64
\[\frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}\]
\[\begin{array}{l} \mathbf{if}\;cos \le -6.168883927619536 \cdot 10^{-205}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(x \cdot \left(sin \cdot cos\right)\right) \cdot \left(sin \cdot cos\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt[3]{\left(\left(x \cdot cos\right) \cdot sin\right) \cdot \left(\left(x \cdot cos\right) \cdot sin\right)} \cdot \sqrt[3]{\left(\left(x \cdot cos\right) \cdot sin\right) \cdot \left(\left(x \cdot cos\right) \cdot sin\right)}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt[3]{\left(\left(x \cdot cos\right) \cdot sin\right) \cdot \left(\left(x \cdot cos\right) \cdot sin\right)}}\\ \end{array}\]
\frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}
\begin{array}{l}
\mathbf{if}\;cos \le -6.168883927619536 \cdot 10^{-205}:\\
\;\;\;\;\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(x \cdot \left(sin \cdot cos\right)\right) \cdot \left(sin \cdot cos\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt[3]{\left(\left(x \cdot cos\right) \cdot sin\right) \cdot \left(\left(x \cdot cos\right) \cdot sin\right)} \cdot \sqrt[3]{\left(\left(x \cdot cos\right) \cdot sin\right) \cdot \left(\left(x \cdot cos\right) \cdot sin\right)}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt[3]{\left(\left(x \cdot cos\right) \cdot sin\right) \cdot \left(\left(x \cdot cos\right) \cdot sin\right)}}\\

\end{array}
double f(double x, double cos, double sin) {
        double r2555340 = 2.0;
        double r2555341 = x;
        double r2555342 = r2555340 * r2555341;
        double r2555343 = cos(r2555342);
        double r2555344 = cos;
        double r2555345 = pow(r2555344, r2555340);
        double r2555346 = sin;
        double r2555347 = pow(r2555346, r2555340);
        double r2555348 = r2555341 * r2555347;
        double r2555349 = r2555348 * r2555341;
        double r2555350 = r2555345 * r2555349;
        double r2555351 = r2555343 / r2555350;
        return r2555351;
}

double f(double x, double cos, double sin) {
        double r2555352 = cos;
        double r2555353 = -6.168883927619536e-205;
        bool r2555354 = r2555352 <= r2555353;
        double r2555355 = 2.0;
        double r2555356 = x;
        double r2555357 = r2555355 * r2555356;
        double r2555358 = cos(r2555357);
        double r2555359 = sin;
        double r2555360 = r2555359 * r2555352;
        double r2555361 = r2555356 * r2555360;
        double r2555362 = r2555361 * r2555360;
        double r2555363 = r2555356 * r2555362;
        double r2555364 = r2555358 / r2555363;
        double r2555365 = 1.0;
        double r2555366 = r2555356 * r2555352;
        double r2555367 = r2555366 * r2555359;
        double r2555368 = r2555367 * r2555367;
        double r2555369 = cbrt(r2555368);
        double r2555370 = r2555369 * r2555369;
        double r2555371 = r2555365 / r2555370;
        double r2555372 = r2555358 / r2555369;
        double r2555373 = r2555371 * r2555372;
        double r2555374 = r2555354 ? r2555364 : r2555373;
        return r2555374;
}

Error

Bits error versus x

Bits error versus cos

Bits error versus sin

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if cos < -6.168883927619536e-205

    1. Initial program 24.6

      \[\frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}\]
    2. Simplified2.3

      \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot \left(x \cdot cos\right)\right)}}\]
    3. Using strategy rm
    4. Applied *-commutative2.3

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot \color{blue}{\left(cos \cdot x\right)}\right)}\]
    5. Applied associate-*r*4.2

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \color{blue}{\left(\left(sin \cdot cos\right) \cdot x\right)}}\]
    6. Applied associate-*r*6.9

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot cos\right)\right) \cdot x}}\]
    7. Simplified5.3

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left(\left(sin \cdot cos\right) \cdot x\right) \cdot \left(sin \cdot cos\right)\right)} \cdot x}\]

    if -6.168883927619536e-205 < cos

    1. Initial program 30.5

      \[\frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}\]
    2. Simplified3.2

      \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot \left(x \cdot cos\right)\right)}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt3.6

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\sqrt[3]{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot \left(x \cdot cos\right)\right)} \cdot \sqrt[3]{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot \left(x \cdot cos\right)\right)}\right) \cdot \sqrt[3]{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot \left(x \cdot cos\right)\right)}}}\]
    5. Applied *-un-lft-identity3.6

      \[\leadsto \frac{\color{blue}{1 \cdot \cos \left(2 \cdot x\right)}}{\left(\sqrt[3]{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot \left(x \cdot cos\right)\right)} \cdot \sqrt[3]{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot \left(x \cdot cos\right)\right)}\right) \cdot \sqrt[3]{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot \left(x \cdot cos\right)\right)}}\]
    6. Applied times-frac3.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;cos \le -6.168883927619536 \cdot 10^{-205}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(\left(x \cdot \left(sin \cdot cos\right)\right) \cdot \left(sin \cdot cos\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt[3]{\left(\left(x \cdot cos\right) \cdot sin\right) \cdot \left(\left(x \cdot cos\right) \cdot sin\right)} \cdot \sqrt[3]{\left(\left(x \cdot cos\right) \cdot sin\right) \cdot \left(\left(x \cdot cos\right) \cdot sin\right)}} \cdot \frac{\cos \left(2 \cdot x\right)}{\sqrt[3]{\left(\left(x \cdot cos\right) \cdot sin\right) \cdot \left(\left(x \cdot cos\right) \cdot sin\right)}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019158 +o rules:numerics
(FPCore (x cos sin)
  :name "cos(2*x)/(cos^2(x)*sin^2(x))"
  (/ (cos (* 2 x)) (* (pow cos 2) (* (* x (pow sin 2)) x))))