Average Error: 28.0 → 2.7
Time: 28.7s
Precision: 64
\[\frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}\]
\[\frac{\cos \left(x \cdot 2\right)}{\left(x \cdot {sin}^{\left(\frac{2}{2}\right)}\right) \cdot {cos}^{\left(\frac{2}{2}\right)}} \cdot \frac{1}{\left(x \cdot {sin}^{\left(\frac{2}{2}\right)}\right) \cdot {cos}^{\left(\frac{2}{2}\right)}}\]
\frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}
\frac{\cos \left(x \cdot 2\right)}{\left(x \cdot {sin}^{\left(\frac{2}{2}\right)}\right) \cdot {cos}^{\left(\frac{2}{2}\right)}} \cdot \frac{1}{\left(x \cdot {sin}^{\left(\frac{2}{2}\right)}\right) \cdot {cos}^{\left(\frac{2}{2}\right)}}
double f(double x, double cos, double sin) {
        double r2943695 = 2.0;
        double r2943696 = x;
        double r2943697 = r2943695 * r2943696;
        double r2943698 = cos(r2943697);
        double r2943699 = cos;
        double r2943700 = pow(r2943699, r2943695);
        double r2943701 = sin;
        double r2943702 = pow(r2943701, r2943695);
        double r2943703 = r2943696 * r2943702;
        double r2943704 = r2943703 * r2943696;
        double r2943705 = r2943700 * r2943704;
        double r2943706 = r2943698 / r2943705;
        return r2943706;
}

double f(double x, double cos, double sin) {
        double r2943707 = x;
        double r2943708 = 2.0;
        double r2943709 = r2943707 * r2943708;
        double r2943710 = cos(r2943709);
        double r2943711 = sin;
        double r2943712 = 2.0;
        double r2943713 = r2943708 / r2943712;
        double r2943714 = pow(r2943711, r2943713);
        double r2943715 = r2943707 * r2943714;
        double r2943716 = cos;
        double r2943717 = pow(r2943716, r2943713);
        double r2943718 = r2943715 * r2943717;
        double r2943719 = r2943710 / r2943718;
        double r2943720 = 1.0;
        double r2943721 = r2943720 / r2943718;
        double r2943722 = r2943719 * r2943721;
        return r2943722;
}

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 28.0

    \[\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-pow28.0

    \[\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*22.0

    \[\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 associate-*l*20.1

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

    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{\left(\frac{2}{2}\right)}\right) \cdot \color{blue}{\left(x \cdot {sin}^{\left(\frac{2}{2}\right)}\right)}\right)}\]
  8. Using strategy rm
  9. Applied sqr-pow20.1

    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left({cos}^{\left(\frac{2}{2}\right)} \cdot {cos}^{\left(\frac{2}{2}\right)}\right)} \cdot \left(\left(x \cdot {sin}^{\left(\frac{2}{2}\right)}\right) \cdot \left(x \cdot {sin}^{\left(\frac{2}{2}\right)}\right)\right)}\]
  10. Applied unswap-sqr2.9

    \[\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 \left({cos}^{\left(\frac{2}{2}\right)} \cdot \left(x \cdot {sin}^{\left(\frac{2}{2}\right)}\right)\right)}}\]
  11. Using strategy rm
  12. Applied *-un-lft-identity2.9

    \[\leadsto \frac{\color{blue}{1 \cdot \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 \left({cos}^{\left(\frac{2}{2}\right)} \cdot \left(x \cdot {sin}^{\left(\frac{2}{2}\right)}\right)\right)}\]
  13. Applied times-frac2.7

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

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

Reproduce

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