Average Error: 4.5 → 2.5
Time: 24.4s
Precision: 64
\[9.999999960041972002500187954865396022797 \cdot 10^{-12} \le \left|pR\right| \le 10^{4}\]
\[\frac{a}{pR} \cdot \left(\cos \left(p0 - pR \cdot t\right) - \cos p0\right)\]
\[\frac{a}{pR} \cdot \left(-2 \cdot \left(\sin \left(\frac{\left(p0 - pR \cdot t\right) + p0}{2}\right) \cdot \sin \left(-\frac{t \cdot pR}{2}\right)\right)\right)\]
\frac{a}{pR} \cdot \left(\cos \left(p0 - pR \cdot t\right) - \cos p0\right)
\frac{a}{pR} \cdot \left(-2 \cdot \left(\sin \left(\frac{\left(p0 - pR \cdot t\right) + p0}{2}\right) \cdot \sin \left(-\frac{t \cdot pR}{2}\right)\right)\right)
double f(double a, double pR, double p0, double t) {
        double r500166 = a;
        double r500167 = pR;
        double r500168 = r500166 / r500167;
        double r500169 = p0;
        double r500170 = t;
        double r500171 = r500167 * r500170;
        double r500172 = r500169 - r500171;
        double r500173 = cos(r500172);
        double r500174 = cos(r500169);
        double r500175 = r500173 - r500174;
        double r500176 = r500168 * r500175;
        return r500176;
}

double f(double a, double pR, double p0, double t) {
        double r500177 = a;
        double r500178 = pR;
        double r500179 = r500177 / r500178;
        double r500180 = -2.0;
        double r500181 = p0;
        double r500182 = t;
        double r500183 = r500178 * r500182;
        double r500184 = r500181 - r500183;
        double r500185 = r500184 + r500181;
        double r500186 = 2.0;
        double r500187 = r500185 / r500186;
        double r500188 = sin(r500187);
        double r500189 = r500182 * r500178;
        double r500190 = r500189 / r500186;
        double r500191 = -r500190;
        double r500192 = sin(r500191);
        double r500193 = r500188 * r500192;
        double r500194 = r500180 * r500193;
        double r500195 = r500179 * r500194;
        return r500195;
}

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} \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} \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} \cdot \left(-2 \cdot \color{blue}{\left(\sin \left(\frac{\left(p0 - pR \cdot t\right) + p0}{2}\right) \cdot \sin \left(-\frac{t \cdot pR}{2}\right)\right)}\right)\]
  5. Final simplification2.5

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

Reproduce

herbie shell --seed 1 
(FPCore (a pR p0 t)
  :name "a / pR * (cos(p0 - pR*t) - cos(p0))"
  :precision binary32
  :pre (<= 9.99999996e-12 (fabs pR) 1e4)
  (* (/ a pR) (- (cos (- p0 (* pR t))) (cos p0))))