Average Error: 28.2 → 5.6
Time: 14.1s
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(2 \cdot x\right)}{{cos}^{\left(\frac{2}{2}\right)} \cdot \left(\left({cos}^{\left(\frac{2}{2}\right)} \cdot \left(x \cdot {sin}^{\left(\frac{2}{2}\right)}\right)\right) \cdot \left(x \cdot {sin}^{\left(\frac{2}{2}\right)}\right)\right)}\]
\frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}
\frac{\cos \left(2 \cdot x\right)}{{cos}^{\left(\frac{2}{2}\right)} \cdot \left(\left({cos}^{\left(\frac{2}{2}\right)} \cdot \left(x \cdot {sin}^{\left(\frac{2}{2}\right)}\right)\right) \cdot \left(x \cdot {sin}^{\left(\frac{2}{2}\right)}\right)\right)}
double f(double x, double cos, double sin) {
        double r74353 = 2.0;
        double r74354 = x;
        double r74355 = r74353 * r74354;
        double r74356 = cos(r74355);
        double r74357 = cos;
        double r74358 = pow(r74357, r74353);
        double r74359 = sin;
        double r74360 = pow(r74359, r74353);
        double r74361 = r74354 * r74360;
        double r74362 = r74361 * r74354;
        double r74363 = r74358 * r74362;
        double r74364 = r74356 / r74363;
        return r74364;
}

double f(double x, double cos, double sin) {
        double r74365 = 2.0;
        double r74366 = x;
        double r74367 = r74365 * r74366;
        double r74368 = cos(r74367);
        double r74369 = cos;
        double r74370 = 2.0;
        double r74371 = r74365 / r74370;
        double r74372 = pow(r74369, r74371);
        double r74373 = sin;
        double r74374 = pow(r74373, r74371);
        double r74375 = r74366 * r74374;
        double r74376 = r74372 * r74375;
        double r74377 = r74376 * r74375;
        double r74378 = r74372 * r74377;
        double r74379 = r74368 / r74378;
        return r74379;
}

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.2

    \[\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.2

    \[\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}^{2}\right) \cdot x\right)}\]
  4. Applied associate-*l*23.4

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

    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{cos}^{\left(\frac{2}{2}\right)} \cdot \left({cos}^{\left(\frac{2}{2}\right)} \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)\right)}\]
  7. Applied associate-*r*16.1

    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{cos}^{\left(\frac{2}{2}\right)} \cdot \left({cos}^{\left(\frac{2}{2}\right)} \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)\right)}\]
  8. Using strategy rm
  9. Applied associate-*l*13.3

    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{cos}^{\left(\frac{2}{2}\right)} \cdot \left({cos}^{\left(\frac{2}{2}\right)} \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)}\right)}\]
  10. Simplified13.3

    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{cos}^{\left(\frac{2}{2}\right)} \cdot \left({cos}^{\left(\frac{2}{2}\right)} \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)\right)}\]
  11. Using strategy rm
  12. Applied associate-*r*5.6

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

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

Reproduce

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