Average Error: 13.7 → 12.7
Time: 14.5s
Precision: 64
$1.000000011686097423080354928970336914062 \cdot 10^{-7} \le \left|pR\right| \le 100$
$\cos \left(p0 + pR \cdot t\right) - \cos p0$
$\cos p0 \cdot \cos \left(pR \cdot t\right) - \left(\sin p0 \cdot \sin \left(pR \cdot t\right) + \cos p0\right)$
\cos \left(p0 + pR \cdot t\right) - \cos p0
\cos p0 \cdot \cos \left(pR \cdot t\right) - \left(\sin p0 \cdot \sin \left(pR \cdot t\right) + \cos p0\right)
double f(double p0, double pR, double t) {
double r2227567 = p0;
double r2227568 = pR;
double r2227569 = t;
double r2227570 = r2227568 * r2227569;
double r2227571 = r2227567 + r2227570;
double r2227572 = cos(r2227571);
double r2227573 = cos(r2227567);
double r2227574 = r2227572 - r2227573;
return r2227574;
}


double f(double p0, double pR, double t) {
double r2227575 = p0;
double r2227576 = cos(r2227575);
double r2227577 = pR;
double r2227578 = t;
double r2227579 = r2227577 * r2227578;
double r2227580 = cos(r2227579);
double r2227581 = r2227576 * r2227580;
double r2227582 = sin(r2227575);
double r2227583 = sin(r2227579);
double r2227584 = r2227582 * r2227583;
double r2227585 = r2227584 + r2227576;
double r2227586 = r2227581 - r2227585;
return r2227586;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 13.7

$\cos \left(p0 + pR \cdot t\right) - \cos p0$
2. Using strategy rm
3. Applied cos-sum12.7

$\leadsto \color{blue}{\left(\cos p0 \cdot \cos \left(pR \cdot t\right) - \sin p0 \cdot \sin \left(pR \cdot t\right)\right)} - \cos p0$
4. Applied associate--l-12.7

$\leadsto \color{blue}{\cos p0 \cdot \cos \left(pR \cdot t\right) - \left(\sin p0 \cdot \sin \left(pR \cdot t\right) + \cos p0\right)}$
5. Final simplification12.7

$\leadsto \cos p0 \cdot \cos \left(pR \cdot t\right) - \left(\sin p0 \cdot \sin \left(pR \cdot t\right) + \cos p0\right)$

# Reproduce

herbie shell --seed 1
(FPCore (p0 pR t)
:name "cos(p0 + pR*t) - cos(p0)"
:precision binary32
:pre (<= 1.00000001e-7 (fabs pR) 100)
(- (cos (+ p0 (* pR t))) (cos p0)))