Average Error: 13.8 → 0.2
Time: 15.7s
Precision: 64
$\cos \left(x + 1\right) - cosx$
$\left(\cos 1 \cdot \cos x - \log \left(e^{\sin x \cdot \sin 1}\right)\right) - cosx$
\cos \left(x + 1\right) - cosx
\left(\cos 1 \cdot \cos x - \log \left(e^{\sin x \cdot \sin 1}\right)\right) - cosx
double f(double x, double cosx) {
double r59581916 = x;
double r59581917 = 1.0;
double r59581918 = r59581916 + r59581917;
double r59581919 = cos(r59581918);
double r59581920 = cosx;
double r59581921 = r59581919 - r59581920;
return r59581921;
}


double f(double x, double cosx) {
double r59581922 = 1.0;
double r59581923 = cos(r59581922);
double r59581924 = x;
double r59581925 = cos(r59581924);
double r59581926 = r59581923 * r59581925;
double r59581927 = sin(r59581924);
double r59581928 = sin(r59581922);
double r59581929 = r59581927 * r59581928;
double r59581930 = exp(r59581929);
double r59581931 = log(r59581930);
double r59581932 = r59581926 - r59581931;
double r59581933 = cosx;
double r59581934 = r59581932 - r59581933;
return r59581934;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 13.8

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

$\leadsto \color{blue}{\left(\cos x \cdot \cos 1 - \sin x \cdot \sin 1\right)} - cosx$
4. Using strategy rm
$\leadsto \left(\cos x \cdot \cos 1 - \color{blue}{\log \left(e^{\sin x \cdot \sin 1}\right)}\right) - cosx$
$\leadsto \left(\cos 1 \cdot \cos x - \log \left(e^{\sin x \cdot \sin 1}\right)\right) - cosx$
herbie shell --seed 1