Average Error: 25.0 → 0.5
Time: 10.9s
Precision: 64
$\cos \left(x + 1\right) + 1$
$\left(\left(\cos x \cdot \left(\sqrt[3]{\cos 1} \cdot \sqrt[3]{\cos 1}\right)\right) \cdot \sqrt[3]{\cos 1} - \sin 1 \cdot \sin x\right) + 1$
\cos \left(x + 1\right) + 1
\left(\left(\cos x \cdot \left(\sqrt[3]{\cos 1} \cdot \sqrt[3]{\cos 1}\right)\right) \cdot \sqrt[3]{\cos 1} - \sin 1 \cdot \sin x\right) + 1
double f(double x) {
double r43009490 = x;
double r43009491 = 1.0;
double r43009492 = r43009490 + r43009491;
double r43009493 = cos(r43009492);
double r43009494 = r43009493 + r43009491;
return r43009494;
}


double f(double x) {
double r43009495 = x;
double r43009496 = cos(r43009495);
double r43009497 = 1.0;
double r43009498 = cos(r43009497);
double r43009499 = cbrt(r43009498);
double r43009500 = r43009499 * r43009499;
double r43009501 = r43009496 * r43009500;
double r43009502 = r43009501 * r43009499;
double r43009503 = sin(r43009497);
double r43009504 = sin(r43009495);
double r43009505 = r43009503 * r43009504;
double r43009506 = r43009502 - r43009505;
double r43009507 = r43009506 + r43009497;
return r43009507;
}



# Try it out

Your Program's Arguments

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 25.0

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

$\leadsto \color{blue}{\left(\cos x \cdot \cos 1 - \sin x \cdot \sin 1\right)} + 1$
4. Using strategy rm
5. Applied add-cube-cbrt0.5

$\leadsto \left(\cos x \cdot \color{blue}{\left(\left(\sqrt[3]{\cos 1} \cdot \sqrt[3]{\cos 1}\right) \cdot \sqrt[3]{\cos 1}\right)} - \sin x \cdot \sin 1\right) + 1$
6. Applied associate-*r*0.5

$\leadsto \left(\color{blue}{\left(\cos x \cdot \left(\sqrt[3]{\cos 1} \cdot \sqrt[3]{\cos 1}\right)\right) \cdot \sqrt[3]{\cos 1}} - \sin x \cdot \sin 1\right) + 1$
7. Final simplification0.5

$\leadsto \left(\left(\cos x \cdot \left(\sqrt[3]{\cos 1} \cdot \sqrt[3]{\cos 1}\right)\right) \cdot \sqrt[3]{\cos 1} - \sin 1 \cdot \sin x\right) + 1$

# Reproduce

herbie shell --seed 1
(FPCore (x)
:name "cos(x+1)+1"
(+ (cos (+ x 1.0)) 1.0))