Average Error: 18.4 → 18.5
Time: 10.6s
Precision: 64
\[\cos \left(3 \cdot x\right) + \cos \left(4 \cdot x\right)\]
\[\frac{{\left(\cos \left(3 \cdot x\right)\right)}^{3} + {\left(\cos \left(4 \cdot x\right)\right)}^{3}}{\cos \left(4 \cdot x\right) \cdot \left(\cos \left(4 \cdot x\right) - \cos \left(3 \cdot x\right)\right) + \cos \left(3 \cdot x\right) \cdot \cos \left(3 \cdot x\right)}\]
\cos \left(3 \cdot x\right) + \cos \left(4 \cdot x\right)
\frac{{\left(\cos \left(3 \cdot x\right)\right)}^{3} + {\left(\cos \left(4 \cdot x\right)\right)}^{3}}{\cos \left(4 \cdot x\right) \cdot \left(\cos \left(4 \cdot x\right) - \cos \left(3 \cdot x\right)\right) + \cos \left(3 \cdot x\right) \cdot \cos \left(3 \cdot x\right)}
double f(double x) {
        double r3415427 = 3.0;
        double r3415428 = x;
        double r3415429 = r3415427 * r3415428;
        double r3415430 = cos(r3415429);
        double r3415431 = 4.0;
        double r3415432 = r3415431 * r3415428;
        double r3415433 = cos(r3415432);
        double r3415434 = r3415430 + r3415433;
        return r3415434;
}

double f(double x) {
        double r3415435 = 3.0;
        double r3415436 = x;
        double r3415437 = r3415435 * r3415436;
        double r3415438 = cos(r3415437);
        double r3415439 = 3.0;
        double r3415440 = pow(r3415438, r3415439);
        double r3415441 = 4.0;
        double r3415442 = r3415441 * r3415436;
        double r3415443 = cos(r3415442);
        double r3415444 = pow(r3415443, r3415439);
        double r3415445 = r3415440 + r3415444;
        double r3415446 = r3415443 - r3415438;
        double r3415447 = r3415443 * r3415446;
        double r3415448 = r3415438 * r3415438;
        double r3415449 = r3415447 + r3415448;
        double r3415450 = r3415445 / r3415449;
        return r3415450;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 18.4

    \[\cos \left(3 \cdot x\right) + \cos \left(4 \cdot x\right)\]
  2. Using strategy rm
  3. Applied flip3-+18.5

    \[\leadsto \color{blue}{\frac{{\left(\cos \left(3 \cdot x\right)\right)}^{3} + {\left(\cos \left(4 \cdot x\right)\right)}^{3}}{\cos \left(3 \cdot x\right) \cdot \cos \left(3 \cdot x\right) + \left(\cos \left(4 \cdot x\right) \cdot \cos \left(4 \cdot x\right) - \cos \left(3 \cdot x\right) \cdot \cos \left(4 \cdot x\right)\right)}}\]
  4. Simplified18.5

    \[\leadsto \frac{{\left(\cos \left(3 \cdot x\right)\right)}^{3} + {\left(\cos \left(4 \cdot x\right)\right)}^{3}}{\color{blue}{\cos \left(4 \cdot x\right) \cdot \left(\cos \left(4 \cdot x\right) - \cos \left(3 \cdot x\right)\right) + \cos \left(3 \cdot x\right) \cdot \cos \left(3 \cdot x\right)}}\]
  5. Final simplification18.5

    \[\leadsto \frac{{\left(\cos \left(3 \cdot x\right)\right)}^{3} + {\left(\cos \left(4 \cdot x\right)\right)}^{3}}{\cos \left(4 \cdot x\right) \cdot \left(\cos \left(4 \cdot x\right) - \cos \left(3 \cdot x\right)\right) + \cos \left(3 \cdot x\right) \cdot \cos \left(3 \cdot x\right)}\]

Reproduce

herbie shell --seed 1 
(FPCore (x)
  :name "cos(3*x)+cos(4*x)"
  :precision binary64
  (+ (cos (* 3 x)) (cos (* 4 x))))