Average Error: 27.4 → 2.7
Time: 25.1s
Precision: 64
\[\frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}\]
\[\cos \left(2 \cdot x\right) \cdot {\left(\left(x \cdot sin\right) \cdot cos\right)}^{-2}\]
\frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}
\cos \left(2 \cdot x\right) \cdot {\left(\left(x \cdot sin\right) \cdot cos\right)}^{-2}
double f(double x, double cos, double sin) {
        double r1960371 = 2.0;
        double r1960372 = x;
        double r1960373 = r1960371 * r1960372;
        double r1960374 = cos(r1960373);
        double r1960375 = cos;
        double r1960376 = pow(r1960375, r1960371);
        double r1960377 = sin;
        double r1960378 = pow(r1960377, r1960371);
        double r1960379 = r1960372 * r1960378;
        double r1960380 = r1960379 * r1960372;
        double r1960381 = r1960376 * r1960380;
        double r1960382 = r1960374 / r1960381;
        return r1960382;
}

double f(double x, double cos, double sin) {
        double r1960383 = 2.0;
        double r1960384 = x;
        double r1960385 = r1960383 * r1960384;
        double r1960386 = cos(r1960385);
        double r1960387 = sin;
        double r1960388 = r1960384 * r1960387;
        double r1960389 = cos;
        double r1960390 = r1960388 * r1960389;
        double r1960391 = -2.0;
        double r1960392 = pow(r1960390, r1960391);
        double r1960393 = r1960386 * r1960392;
        return r1960393;
}

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

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

    \[\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 clear-num2.7

    \[\leadsto \color{blue}{\frac{1}{\frac{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot \left(x \cdot cos\right)\right)}{\cos \left(2 \cdot x\right)}}}\]
  5. Using strategy rm
  6. Applied *-un-lft-identity2.7

    \[\leadsto \frac{1}{\frac{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot \left(x \cdot cos\right)\right)}{\color{blue}{1 \cdot \cos \left(2 \cdot x\right)}}}\]
  7. Applied times-frac2.7

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

    \[\leadsto \color{blue}{\frac{\frac{1}{\frac{sin \cdot \left(x \cdot cos\right)}{1}}}{\frac{sin \cdot \left(x \cdot cos\right)}{\cos \left(2 \cdot x\right)}}}\]
  9. Using strategy rm
  10. Applied associate-/r/2.4

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

    \[\leadsto \color{blue}{\frac{\frac{1}{cos \cdot \left(sin \cdot x\right)}}{cos \cdot \left(sin \cdot x\right)}} \cdot \cos \left(2 \cdot x\right)\]
  12. Using strategy rm
  13. Applied pow12.7

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

    \[\leadsto \frac{\frac{1}{cos \cdot \left(sin \cdot x\right)}}{cos \cdot \left(\color{blue}{{sin}^{1}} \cdot {x}^{1}\right)} \cdot \cos \left(2 \cdot x\right)\]
  15. Applied pow-prod-down2.7

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

    \[\leadsto \frac{\frac{1}{cos \cdot \left(sin \cdot x\right)}}{\color{blue}{{cos}^{1}} \cdot {\left(sin \cdot x\right)}^{1}} \cdot \cos \left(2 \cdot x\right)\]
  17. Applied pow-prod-down2.7

    \[\leadsto \frac{\frac{1}{cos \cdot \left(sin \cdot x\right)}}{\color{blue}{{\left(cos \cdot \left(sin \cdot x\right)\right)}^{1}}} \cdot \cos \left(2 \cdot x\right)\]
  18. Applied inv-pow2.7

    \[\leadsto \frac{\color{blue}{{\left(cos \cdot \left(sin \cdot x\right)\right)}^{-1}}}{{\left(cos \cdot \left(sin \cdot x\right)\right)}^{1}} \cdot \cos \left(2 \cdot x\right)\]
  19. Applied pow-div2.7

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

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

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

Reproduce

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