Average Error: 13.2 → 0.2
Time: 12.5s
Precision: 64
\[cosx + \cos \left(x + 1\right)\]
\[cosx + \left(\cos 1 \cdot \cos x - \left(\sqrt{\sin 1} \cdot \sin x\right) \cdot \sqrt{\sin 1}\right)\]
cosx + \cos \left(x + 1\right)
cosx + \left(\cos 1 \cdot \cos x - \left(\sqrt{\sin 1} \cdot \sin x\right) \cdot \sqrt{\sin 1}\right)
double f(double cosx, double x) {
        double r59226640 = cosx;
        double r59226641 = x;
        double r59226642 = 1.0;
        double r59226643 = r59226641 + r59226642;
        double r59226644 = cos(r59226643);
        double r59226645 = r59226640 + r59226644;
        return r59226645;
}

double f(double cosx, double x) {
        double r59226646 = cosx;
        double r59226647 = 1.0;
        double r59226648 = cos(r59226647);
        double r59226649 = x;
        double r59226650 = cos(r59226649);
        double r59226651 = r59226648 * r59226650;
        double r59226652 = sin(r59226647);
        double r59226653 = sqrt(r59226652);
        double r59226654 = sin(r59226649);
        double r59226655 = r59226653 * r59226654;
        double r59226656 = r59226655 * r59226653;
        double r59226657 = r59226651 - r59226656;
        double r59226658 = r59226646 + r59226657;
        return r59226658;
}

Error

Bits error versus cosx

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 13.2

    \[cosx + \cos \left(x + 1\right)\]
  2. Using strategy rm
  3. Applied cos-sum0.2

    \[\leadsto cosx + \color{blue}{\left(\cos x \cdot \cos 1 - \sin x \cdot \sin 1\right)}\]
  4. Using strategy rm
  5. Applied add-sqr-sqrt0.2

    \[\leadsto cosx + \left(\cos x \cdot \cos 1 - \sin x \cdot \color{blue}{\left(\sqrt{\sin 1} \cdot \sqrt{\sin 1}\right)}\right)\]
  6. Applied associate-*r*0.2

    \[\leadsto cosx + \left(\cos x \cdot \cos 1 - \color{blue}{\left(\sin x \cdot \sqrt{\sin 1}\right) \cdot \sqrt{\sin 1}}\right)\]
  7. Final simplification0.2

    \[\leadsto cosx + \left(\cos 1 \cdot \cos x - \left(\sqrt{\sin 1} \cdot \sin x\right) \cdot \sqrt{\sin 1}\right)\]

Reproduce

herbie shell --seed 1 
(FPCore (cosx x)
  :name "cosx+cos(x+1)"
  (+ cosx (cos (+ x 1))))