Average Error: 27.6 → 2.6
Time: 7.6s
Precision: 64
\[\frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}\]
\[\frac{\frac{\cos \left(2 \cdot x\right)}{\left|{\left({cos}^{1} \cdot {sin}^{1}\right)}^{1} \cdot x\right|}}{\left|{\left({cos}^{1} \cdot {sin}^{1}\right)}^{1} \cdot x\right|}\]
\frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}
\frac{\frac{\cos \left(2 \cdot x\right)}{\left|{\left({cos}^{1} \cdot {sin}^{1}\right)}^{1} \cdot x\right|}}{\left|{\left({cos}^{1} \cdot {sin}^{1}\right)}^{1} \cdot x\right|}
double f(double x, double cos, double sin) {
        double r49125 = 2.0;
        double r49126 = x;
        double r49127 = r49125 * r49126;
        double r49128 = cos(r49127);
        double r49129 = cos;
        double r49130 = pow(r49129, r49125);
        double r49131 = sin;
        double r49132 = pow(r49131, r49125);
        double r49133 = r49126 * r49132;
        double r49134 = r49133 * r49126;
        double r49135 = r49130 * r49134;
        double r49136 = r49128 / r49135;
        return r49136;
}

double f(double x, double cos, double sin) {
        double r49137 = 2.0;
        double r49138 = x;
        double r49139 = r49137 * r49138;
        double r49140 = cos(r49139);
        double r49141 = cos;
        double r49142 = 1.0;
        double r49143 = pow(r49141, r49142);
        double r49144 = sin;
        double r49145 = pow(r49144, r49142);
        double r49146 = r49143 * r49145;
        double r49147 = pow(r49146, r49142);
        double r49148 = r49147 * r49138;
        double r49149 = fabs(r49148);
        double r49150 = r49140 / r49149;
        double r49151 = r49150 / r49149;
        return r49151;
}

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. 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. Using strategy rm
  3. Applied sqr-pow27.6

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

    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\color{blue}{\left(\left(x \cdot {sin}^{\left(\frac{2}{2}\right)}\right) \cdot {sin}^{\left(\frac{2}{2}\right)}\right)} \cdot x\right)}\]
  5. Using strategy rm
  6. Applied add-sqr-sqrt21.8

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

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

    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left|{cos}^{\left(\frac{2}{2}\right)} \cdot \left(x \cdot {sin}^{\left(\frac{2}{2}\right)}\right)\right| \cdot \color{blue}{\left|{cos}^{\left(\frac{2}{2}\right)} \cdot \left(x \cdot {sin}^{\left(\frac{2}{2}\right)}\right)\right|}}\]
  9. Taylor expanded around inf 2.9

    \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{{\left(\left|{\left({cos}^{1} \cdot {sin}^{1}\right)}^{1} \cdot x\right|\right)}^{2}}}\]
  10. Using strategy rm
  11. Applied unpow22.9

    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left|{\left({cos}^{1} \cdot {sin}^{1}\right)}^{1} \cdot x\right| \cdot \left|{\left({cos}^{1} \cdot {sin}^{1}\right)}^{1} \cdot x\right|}}\]
  12. Applied associate-/r*2.6

    \[\leadsto \color{blue}{\frac{\frac{\cos \left(2 \cdot x\right)}{\left|{\left({cos}^{1} \cdot {sin}^{1}\right)}^{1} \cdot x\right|}}{\left|{\left({cos}^{1} \cdot {sin}^{1}\right)}^{1} \cdot x\right|}}\]
  13. Final simplification2.6

    \[\leadsto \frac{\frac{\cos \left(2 \cdot x\right)}{\left|{\left({cos}^{1} \cdot {sin}^{1}\right)}^{1} \cdot x\right|}}{\left|{\left({cos}^{1} \cdot {sin}^{1}\right)}^{1} \cdot x\right|}\]

Reproduce

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