Average Error: 27.9 → 2.6
Time: 18.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}\;x \le 1.2328361595450645 \cdot 10^{-266}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{\left(\left(cos \cdot x\right) \cdot sin\right) \cdot \left(\left(\sqrt[3]{sin} \cdot \left(cos \cdot x\right)\right) \cdot \left(\sqrt[3]{sin} \cdot \sqrt[3]{sin}\right)\right)}\\ \mathbf{elif}\;x \le 2.3583945307121096 \cdot 10^{+180}:\\ \;\;\;\;\frac{1}{\frac{\left(x \cdot \left(cos \cdot sin\right)\right) \cdot \left(x \cdot \left(cos \cdot sin\right)\right)}{\cos \left(2 \cdot x\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{\left(\left(cos \cdot x\right) \cdot sin\right) \cdot \left(\left(\sqrt[3]{sin} \cdot \left(cos \cdot x\right)\right) \cdot \left(\sqrt[3]{sin} \cdot \sqrt[3]{sin}\right)\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}\;x \le 1.2328361595450645 \cdot 10^{-266}:\\
\;\;\;\;\frac{\cos \left(2 \cdot x\right)}{\left(\left(cos \cdot x\right) \cdot sin\right) \cdot \left(\left(\sqrt[3]{sin} \cdot \left(cos \cdot x\right)\right) \cdot \left(\sqrt[3]{sin} \cdot \sqrt[3]{sin}\right)\right)}\\

\mathbf{elif}\;x \le 2.3583945307121096 \cdot 10^{+180}:\\
\;\;\;\;\frac{1}{\frac{\left(x \cdot \left(cos \cdot sin\right)\right) \cdot \left(x \cdot \left(cos \cdot sin\right)\right)}{\cos \left(2 \cdot x\right)}}\\

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

\end{array}
double f(double x, double cos, double sin) {
        double r1109577 = 2.0;
        double r1109578 = x;
        double r1109579 = r1109577 * r1109578;
        double r1109580 = cos(r1109579);
        double r1109581 = cos;
        double r1109582 = pow(r1109581, r1109577);
        double r1109583 = sin;
        double r1109584 = pow(r1109583, r1109577);
        double r1109585 = r1109578 * r1109584;
        double r1109586 = r1109585 * r1109578;
        double r1109587 = r1109582 * r1109586;
        double r1109588 = r1109580 / r1109587;
        return r1109588;
}

double f(double x, double cos, double sin) {
        double r1109589 = x;
        double r1109590 = 1.2328361595450645e-266;
        bool r1109591 = r1109589 <= r1109590;
        double r1109592 = 2.0;
        double r1109593 = r1109592 * r1109589;
        double r1109594 = cos(r1109593);
        double r1109595 = cos;
        double r1109596 = r1109595 * r1109589;
        double r1109597 = sin;
        double r1109598 = r1109596 * r1109597;
        double r1109599 = cbrt(r1109597);
        double r1109600 = r1109599 * r1109596;
        double r1109601 = r1109599 * r1109599;
        double r1109602 = r1109600 * r1109601;
        double r1109603 = r1109598 * r1109602;
        double r1109604 = r1109594 / r1109603;
        double r1109605 = 2.3583945307121096e+180;
        bool r1109606 = r1109589 <= r1109605;
        double r1109607 = 1.0;
        double r1109608 = r1109595 * r1109597;
        double r1109609 = r1109589 * r1109608;
        double r1109610 = r1109609 * r1109609;
        double r1109611 = r1109610 / r1109594;
        double r1109612 = r1109607 / r1109611;
        double r1109613 = r1109606 ? r1109612 : r1109604;
        double r1109614 = r1109591 ? r1109604 : r1109613;
        return r1109614;
}

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 x < 1.2328361595450645e-266 or 2.3583945307121096e+180 < x

    1. Initial program 28.1

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

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

      \[\leadsto \color{blue}{\frac{\frac{\cos \left(2 \cdot x\right)}{x \cdot \left(sin \cdot cos\right)}}{x \cdot \left(sin \cdot cos\right)}}\]
    5. Using strategy rm
    6. Applied associate-/r*3.3

      \[\leadsto \frac{\color{blue}{\frac{\frac{\cos \left(2 \cdot x\right)}{x}}{sin \cdot cos}}}{x \cdot \left(sin \cdot cos\right)}\]
    7. Taylor expanded around inf 31.6

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

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

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\color{blue}{\left(\left(\sqrt[3]{sin} \cdot \sqrt[3]{sin}\right) \cdot \sqrt[3]{sin}\right)} \cdot \left(cos \cdot x\right)\right) \cdot \left(sin \cdot \left(cos \cdot x\right)\right)}\]
    11. Applied associate-*l*3.1

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

    if 1.2328361595450645e-266 < x < 2.3583945307121096e+180

    1. Initial program 27.6

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

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

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

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

Reproduce

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