Average Error: 4.6 → 2.5
Time: 23.0s
Precision: 64
\[1.000000016862383526387164645043981181516 \cdot 10^{-16} \le \left|pR\right| \le 10^{6}\]
\[\frac{a}{{pR}^{2}} \cdot \left(\cos \left(p0 + pR \cdot t\right) - \cos p0\right)\]
\[\frac{a}{{pR}^{2}} \cdot \left(-2 \cdot \left(\sin \left(p0 + \frac{1}{2} \cdot \left(t \cdot pR\right)\right) \cdot \sin \left(\frac{pR \cdot t}{2}\right)\right)\right)\]
\frac{a}{{pR}^{2}} \cdot \left(\cos \left(p0 + pR \cdot t\right) - \cos p0\right)
\frac{a}{{pR}^{2}} \cdot \left(-2 \cdot \left(\sin \left(p0 + \frac{1}{2} \cdot \left(t \cdot pR\right)\right) \cdot \sin \left(\frac{pR \cdot t}{2}\right)\right)\right)
double f(double a, double pR, double p0, double t) {
        double r2238850 = a;
        double r2238851 = pR;
        double r2238852 = 2.0;
        double r2238853 = pow(r2238851, r2238852);
        double r2238854 = r2238850 / r2238853;
        double r2238855 = p0;
        double r2238856 = t;
        double r2238857 = r2238851 * r2238856;
        double r2238858 = r2238855 + r2238857;
        double r2238859 = cos(r2238858);
        double r2238860 = cos(r2238855);
        double r2238861 = r2238859 - r2238860;
        double r2238862 = r2238854 * r2238861;
        return r2238862;
}

double f(double a, double pR, double p0, double t) {
        double r2238863 = a;
        double r2238864 = pR;
        double r2238865 = 2.0;
        double r2238866 = pow(r2238864, r2238865);
        double r2238867 = r2238863 / r2238866;
        double r2238868 = -2.0;
        double r2238869 = p0;
        double r2238870 = 0.5;
        double r2238871 = t;
        double r2238872 = r2238871 * r2238864;
        double r2238873 = r2238870 * r2238872;
        double r2238874 = r2238869 + r2238873;
        double r2238875 = sin(r2238874);
        double r2238876 = r2238864 * r2238871;
        double r2238877 = 2.0;
        double r2238878 = r2238876 / r2238877;
        double r2238879 = sin(r2238878);
        double r2238880 = r2238875 * r2238879;
        double r2238881 = r2238868 * r2238880;
        double r2238882 = r2238867 * r2238881;
        return r2238882;
}

Error

Bits error versus a

Bits error versus pR

Bits error versus p0

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 4.6

    \[\frac{a}{{pR}^{2}} \cdot \left(\cos \left(p0 + pR \cdot t\right) - \cos p0\right)\]
  2. Using strategy rm
  3. Applied diff-cos4.2

    \[\leadsto \frac{a}{{pR}^{2}} \cdot \color{blue}{\left(-2 \cdot \left(\sin \left(\frac{\left(p0 + pR \cdot t\right) - p0}{2}\right) \cdot \sin \left(\frac{\left(p0 + pR \cdot t\right) + p0}{2}\right)\right)\right)}\]
  4. Simplified2.5

    \[\leadsto \frac{a}{{pR}^{2}} \cdot \left(-2 \cdot \color{blue}{\left(\sin \left(\frac{\left(p0 + pR \cdot t\right) + p0}{2}\right) \cdot \sin \left(\frac{pR \cdot t}{2}\right)\right)}\right)\]
  5. Taylor expanded around inf 2.5

    \[\leadsto \frac{a}{{pR}^{2}} \cdot \left(-2 \cdot \left(\color{blue}{\sin \left(\frac{1}{2} \cdot \left(t \cdot pR + 2 \cdot p0\right)\right)} \cdot \sin \left(\frac{pR \cdot t}{2}\right)\right)\right)\]
  6. Simplified2.5

    \[\leadsto \frac{a}{{pR}^{2}} \cdot \left(-2 \cdot \left(\color{blue}{\sin \left(p0 + \frac{1}{2} \cdot \left(t \cdot pR\right)\right)} \cdot \sin \left(\frac{pR \cdot t}{2}\right)\right)\right)\]
  7. Final simplification2.5

    \[\leadsto \frac{a}{{pR}^{2}} \cdot \left(-2 \cdot \left(\sin \left(p0 + \frac{1}{2} \cdot \left(t \cdot pR\right)\right) \cdot \sin \left(\frac{pR \cdot t}{2}\right)\right)\right)\]

Reproduce

herbie shell --seed 1 
(FPCore (a pR p0 t)
  :name "a/pR^2*(cos(p0 + pR*t) - cos(p0))"
  :precision binary32
  :pre (<= 1.00000002e-16 (fabs pR) 1e6)
  (* (/ a (pow pR 2)) (- (cos (+ p0 (* pR t))) (cos p0))))