Average Error: 0.1 → 0.1
Time: 15.9s
Precision: 64
$\sqrt{\sin x + \cos x}$
$\sqrt{\log \left(e^{\sin x + \cos x}\right)}$
\sqrt{\sin x + \cos x}
\sqrt{\log \left(e^{\sin x + \cos x}\right)}
double f(double x) {
double r1086976 = x;
double r1086977 = sin(r1086976);
double r1086978 = cos(r1086976);
double r1086979 = r1086977 + r1086978;
double r1086980 = sqrt(r1086979);
return r1086980;
}


double f(double x) {
double r1086981 = x;
double r1086982 = sin(r1086981);
double r1086983 = cos(r1086981);
double r1086984 = r1086982 + r1086983;
double r1086985 = exp(r1086984);
double r1086986 = log(r1086985);
double r1086987 = sqrt(r1086986);
return r1086987;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 0.1

$\sqrt{\sin x + \cos x}$
2. Using strategy rm

$\leadsto \sqrt{\sin x + \color{blue}{\log \left(e^{\cos x}\right)}}$

$\leadsto \sqrt{\color{blue}{\log \left(e^{\sin x}\right)} + \log \left(e^{\cos x}\right)}$
5. Applied sum-log0.2

$\leadsto \sqrt{\color{blue}{\log \left(e^{\sin x} \cdot e^{\cos x}\right)}}$
6. Simplified0.1

$\leadsto \sqrt{\log \color{blue}{\left(e^{\sin x + \cos x}\right)}}$
7. Final simplification0.1

$\leadsto \sqrt{\log \left(e^{\sin x + \cos x}\right)}$

# Reproduce

herbie shell --seed 1
(FPCore (x)
:name "sqrt(sin(x) + cos(x))"
:precision binary64
(sqrt (+ (sin x) (cos x))))