Average Error: 10.9 → 0.0
Time: 8.9s
Precision: 64
$\sqrt{\sqrt{1 - x}} + \sqrt{x \cdot x}$
$\left|x\right| + \sqrt{\sqrt{1 - x}}$
\sqrt{\sqrt{1 - x}} + \sqrt{x \cdot x}
\left|x\right| + \sqrt{\sqrt{1 - x}}
double f(double x) {
double r1784933 = 1.0;
double r1784934 = x;
double r1784935 = r1784933 - r1784934;
double r1784936 = sqrt(r1784935);
double r1784937 = sqrt(r1784936);
double r1784938 = r1784934 * r1784934;
double r1784939 = sqrt(r1784938);
double r1784940 = r1784937 + r1784939;
return r1784940;
}


double f(double x) {
double r1784941 = x;
double r1784942 = fabs(r1784941);
double r1784943 = 1.0;
double r1784944 = r1784943 - r1784941;
double r1784945 = sqrt(r1784944);
double r1784946 = sqrt(r1784945);
double r1784947 = r1784942 + r1784946;
return r1784947;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 10.9

$\sqrt{\sqrt{1 - x}} + \sqrt{x \cdot x}$
2. Simplified0.0

$\leadsto \color{blue}{\left|x\right| + \sqrt{\sqrt{1 - x}}}$
3. Final simplification0.0

$\leadsto \left|x\right| + \sqrt{\sqrt{1 - x}}$

# Reproduce

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