Average Error: 27.3 → 2.6
Time: 2.0m
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}\;sin \le 1.9148565062812067 \cdot 10^{-221}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot sin\right) \cdot cos\right) \cdot \left(\left(x \cdot sin\right) \cdot cos\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt[3]{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{sin}}{x \cdot cos}}{\left(x \cdot cos\right) \cdot sin}} \cdot \sqrt[3]{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{sin}}{x \cdot cos}}{\left(x \cdot cos\right) \cdot sin}}\right) \cdot \sqrt[3]{\frac{\frac{\frac{\cos \left(2 \cdot x\right)}{sin}}{x \cdot cos}}{\left(x \cdot cos\right) \cdot sin}}\\ \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}\;sin \le 1.9148565062812067 \cdot 10^{-221}:\\
\;\;\;\;\frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot sin\right) \cdot cos\right) \cdot \left(\left(x \cdot sin\right) \cdot cos\right)}\\

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

\end{array}
double f(double x, double cos, double sin) {
        double r14783056 = 2.0;
        double r14783057 = x;
        double r14783058 = r14783056 * r14783057;
        double r14783059 = cos(r14783058);
        double r14783060 = cos;
        double r14783061 = pow(r14783060, r14783056);
        double r14783062 = sin;
        double r14783063 = pow(r14783062, r14783056);
        double r14783064 = r14783057 * r14783063;
        double r14783065 = r14783064 * r14783057;
        double r14783066 = r14783061 * r14783065;
        double r14783067 = r14783059 / r14783066;
        return r14783067;
}

double f(double x, double cos, double sin) {
        double r14783068 = sin;
        double r14783069 = 1.9148565062812067e-221;
        bool r14783070 = r14783068 <= r14783069;
        double r14783071 = 2.0;
        double r14783072 = x;
        double r14783073 = r14783071 * r14783072;
        double r14783074 = cos(r14783073);
        double r14783075 = r14783072 * r14783068;
        double r14783076 = cos;
        double r14783077 = r14783075 * r14783076;
        double r14783078 = r14783077 * r14783077;
        double r14783079 = r14783074 / r14783078;
        double r14783080 = r14783074 / r14783068;
        double r14783081 = r14783072 * r14783076;
        double r14783082 = r14783080 / r14783081;
        double r14783083 = r14783081 * r14783068;
        double r14783084 = r14783082 / r14783083;
        double r14783085 = cbrt(r14783084);
        double r14783086 = r14783085 * r14783085;
        double r14783087 = r14783086 * r14783085;
        double r14783088 = r14783070 ? r14783079 : r14783087;
        return r14783088;
}

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 sin < 1.9148565062812067e-221

    1. Initial program 30.2

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

      \[\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. Taylor expanded around inf 33.5

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

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

    if 1.9148565062812067e-221 < sin

    1. Initial program 24.2

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

      \[\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 associate-/r*1.7

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

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

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

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

Reproduce

herbie shell --seed 2019107 
(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))))