Average Error: 13.5 → 0.2
Time: 11.5s
Precision: 64
${cos}^{2} \cdot x + {sin}^{2} \cdot x$
${cos}^{\left(\frac{2}{2}\right)} \cdot \left({cos}^{\left(\frac{2}{2}\right)} \cdot x\right) + {sin}^{\left(\frac{2}{2}\right)} \cdot \left({sin}^{\left(\frac{2}{2}\right)} \cdot x\right)$
{cos}^{2} \cdot x + {sin}^{2} \cdot x
{cos}^{\left(\frac{2}{2}\right)} \cdot \left({cos}^{\left(\frac{2}{2}\right)} \cdot x\right) + {sin}^{\left(\frac{2}{2}\right)} \cdot \left({sin}^{\left(\frac{2}{2}\right)} \cdot x\right)
double f(double cos, double x, double sin) {
double r773101 = cos;
double r773102 = 2.0;
double r773103 = pow(r773101, r773102);
double r773104 = x;
double r773105 = r773103 * r773104;
double r773106 = sin;
double r773107 = pow(r773106, r773102);
double r773108 = r773107 * r773104;
double r773109 = r773105 + r773108;
return r773109;
}


double f(double cos, double x, double sin) {
double r773110 = cos;
double r773111 = 2.0;
double r773112 = 2.0;
double r773113 = r773111 / r773112;
double r773114 = pow(r773110, r773113);
double r773115 = x;
double r773116 = r773114 * r773115;
double r773117 = r773114 * r773116;
double r773118 = sin;
double r773119 = pow(r773118, r773113);
double r773120 = r773119 * r773115;
double r773121 = r773119 * r773120;
double r773122 = r773117 + r773121;
return r773122;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 13.5

${cos}^{2} \cdot x + {sin}^{2} \cdot x$
2. Using strategy rm
3. Applied sqr-pow13.5

$\leadsto {cos}^{2} \cdot x + \color{blue}{\left({sin}^{\left(\frac{2}{2}\right)} \cdot {sin}^{\left(\frac{2}{2}\right)}\right)} \cdot x$
4. Applied associate-*l*7.4

$\leadsto {cos}^{2} \cdot x + \color{blue}{{sin}^{\left(\frac{2}{2}\right)} \cdot \left({sin}^{\left(\frac{2}{2}\right)} \cdot x\right)}$
5. Using strategy rm
6. Applied sqr-pow7.4

$\leadsto \color{blue}{\left({cos}^{\left(\frac{2}{2}\right)} \cdot {cos}^{\left(\frac{2}{2}\right)}\right)} \cdot x + {sin}^{\left(\frac{2}{2}\right)} \cdot \left({sin}^{\left(\frac{2}{2}\right)} \cdot x\right)$
7. Applied associate-*l*0.2

$\leadsto \color{blue}{{cos}^{\left(\frac{2}{2}\right)} \cdot \left({cos}^{\left(\frac{2}{2}\right)} \cdot x\right)} + {sin}^{\left(\frac{2}{2}\right)} \cdot \left({sin}^{\left(\frac{2}{2}\right)} \cdot x\right)$
8. Final simplification0.2

$\leadsto {cos}^{\left(\frac{2}{2}\right)} \cdot \left({cos}^{\left(\frac{2}{2}\right)} \cdot x\right) + {sin}^{\left(\frac{2}{2}\right)} \cdot \left({sin}^{\left(\frac{2}{2}\right)} \cdot x\right)$

# Reproduce

herbie shell --seed 1
(FPCore (cos x sin)
:name "cos^2(x) + sin^2(x)"
:precision binary64
(+ (* (pow cos 2) x) (* (pow sin 2) x)))