Average Error: 4.5 → 2.5
Time: 22.9s
Precision: 64
\[1.000000013351431960018089739605784416199 \cdot 10^{-10} \le pR \le 10^{9}\]
\[\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(\frac{\left(p0 + pR \cdot t\right) + p0}{2}\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(\frac{\left(p0 + pR \cdot t\right) + p0}{2}\right) \cdot \sin \left(\frac{pR \cdot t}{2}\right)\right)\right)
double f(double a, double pR, double p0, double t) {
        double r3156367 = a;
        double r3156368 = pR;
        double r3156369 = 2.0;
        double r3156370 = pow(r3156368, r3156369);
        double r3156371 = r3156367 / r3156370;
        double r3156372 = p0;
        double r3156373 = t;
        double r3156374 = r3156368 * r3156373;
        double r3156375 = r3156372 + r3156374;
        double r3156376 = cos(r3156375);
        double r3156377 = cos(r3156372);
        double r3156378 = r3156376 - r3156377;
        double r3156379 = r3156371 * r3156378;
        return r3156379;
}

double f(double a, double pR, double p0, double t) {
        double r3156380 = a;
        double r3156381 = pR;
        double r3156382 = 2.0;
        double r3156383 = pow(r3156381, r3156382);
        double r3156384 = r3156380 / r3156383;
        double r3156385 = -2.0;
        double r3156386 = p0;
        double r3156387 = t;
        double r3156388 = r3156381 * r3156387;
        double r3156389 = r3156386 + r3156388;
        double r3156390 = r3156389 + r3156386;
        double r3156391 = 2.0;
        double r3156392 = r3156390 / r3156391;
        double r3156393 = sin(r3156392);
        double r3156394 = r3156388 / r3156391;
        double r3156395 = sin(r3156394);
        double r3156396 = r3156393 * r3156395;
        double r3156397 = r3156385 * r3156396;
        double r3156398 = r3156384 * r3156397;
        return r3156398;
}

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

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

    \[\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. Final simplification2.5

    \[\leadsto \frac{a}{{pR}^{2}} \cdot \left(-2 \cdot \left(\sin \left(\frac{\left(p0 + pR \cdot t\right) + p0}{2}\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.00000001e-10 pR 1e9)
  (* (/ a (pow pR 2)) (- (cos (+ p0 (* pR t))) (cos p0))))