Average Error: 27.9 → 2.6
Time: 22.4s
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(sin \cdot \left(cos \cdot x\right)\right) \cdot \left(\left(\sqrt[3]{sin} \cdot \sqrt[3]{sin}\right) \cdot \left(\left(cos \cdot x\right) \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(sin \cdot \left(cos \cdot x\right)\right) \cdot \left(\left(\sqrt[3]{sin} \cdot \sqrt[3]{sin}\right) \cdot \left(\left(cos \cdot x\right) \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(sin \cdot \left(cos \cdot x\right)\right) \cdot \left(\left(\sqrt[3]{sin} \cdot \sqrt[3]{sin}\right) \cdot \left(\left(cos \cdot x\right) \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(sin \cdot \left(cos \cdot x\right)\right) \cdot \left(\left(\sqrt[3]{sin} \cdot \sqrt[3]{sin}\right) \cdot \left(\left(cos \cdot x\right) \cdot \sqrt[3]{sin}\right)\right)}\\

\end{array}
double f(double x, double cos, double sin) {
        double r1142859 = 2.0;
        double r1142860 = x;
        double r1142861 = r1142859 * r1142860;
        double r1142862 = cos(r1142861);
        double r1142863 = cos;
        double r1142864 = pow(r1142863, r1142859);
        double r1142865 = sin;
        double r1142866 = pow(r1142865, r1142859);
        double r1142867 = r1142860 * r1142866;
        double r1142868 = r1142867 * r1142860;
        double r1142869 = r1142864 * r1142868;
        double r1142870 = r1142862 / r1142869;
        return r1142870;
}

double f(double x, double cos, double sin) {
        double r1142871 = x;
        double r1142872 = 1.2328361595450645e-266;
        bool r1142873 = r1142871 <= r1142872;
        double r1142874 = 2.0;
        double r1142875 = r1142874 * r1142871;
        double r1142876 = cos(r1142875);
        double r1142877 = sin;
        double r1142878 = cos;
        double r1142879 = r1142878 * r1142871;
        double r1142880 = r1142877 * r1142879;
        double r1142881 = cbrt(r1142877);
        double r1142882 = r1142881 * r1142881;
        double r1142883 = r1142879 * r1142881;
        double r1142884 = r1142882 * r1142883;
        double r1142885 = r1142880 * r1142884;
        double r1142886 = r1142876 / r1142885;
        double r1142887 = 2.3583945307121096e+180;
        bool r1142888 = r1142871 <= r1142887;
        double r1142889 = 1.0;
        double r1142890 = r1142878 * r1142877;
        double r1142891 = r1142871 * r1142890;
        double r1142892 = r1142891 * r1142891;
        double r1142893 = r1142892 / r1142876;
        double r1142894 = r1142889 / r1142893;
        double r1142895 = r1142888 ? r1142894 : r1142886;
        double r1142896 = r1142873 ? r1142886 : r1142895;
        return r1142896;
}

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(sin \cdot \left(cos \cdot x\right)\right) \cdot \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)}\]
    11. Applied associate-*l*3.1

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(sin \cdot \left(cos \cdot x\right)\right) \cdot \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)}}\]

    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 *-un-lft-identity1.6

      \[\leadsto \frac{\color{blue}{1 \cdot \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)}\]
    5. Applied associate-/l*1.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(sin \cdot \left(cos \cdot x\right)\right) \cdot \left(\left(\sqrt[3]{sin} \cdot \sqrt[3]{sin}\right) \cdot \left(\left(cos \cdot x\right) \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(sin \cdot \left(cos \cdot x\right)\right) \cdot \left(\left(\sqrt[3]{sin} \cdot \sqrt[3]{sin}\right) \cdot \left(\left(cos \cdot x\right) \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))))