Average Error: 0.1 → 0.1
Time: 10.8s
Precision: 64
$\sqrt{\sqrt{x - 1} - 1} + \sqrt{x \cdot 4}$
$\sqrt{\sqrt{x - 1} - 1} + \sqrt{x} \cdot \sqrt{4}$
\sqrt{\sqrt{x - 1} - 1} + \sqrt{x \cdot 4}
\sqrt{\sqrt{x - 1} - 1} + \sqrt{x} \cdot \sqrt{4}
double f(double x) {
double r2279525 = x;
double r2279526 = 1.0;
double r2279527 = r2279525 - r2279526;
double r2279528 = sqrt(r2279527);
double r2279529 = r2279528 - r2279526;
double r2279530 = sqrt(r2279529);
double r2279531 = 4.0;
double r2279532 = r2279525 * r2279531;
double r2279533 = sqrt(r2279532);
double r2279534 = r2279530 + r2279533;
return r2279534;
}


double f(double x) {
double r2279535 = x;
double r2279536 = 1.0;
double r2279537 = r2279535 - r2279536;
double r2279538 = sqrt(r2279537);
double r2279539 = r2279538 - r2279536;
double r2279540 = sqrt(r2279539);
double r2279541 = sqrt(r2279535);
double r2279542 = 4.0;
double r2279543 = sqrt(r2279542);
double r2279544 = r2279541 * r2279543;
double r2279545 = r2279540 + r2279544;
return r2279545;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 0.1

$\sqrt{\sqrt{x - 1} - 1} + \sqrt{x \cdot 4}$
2. Using strategy rm
3. Applied sqrt-prod0.1

$\leadsto \sqrt{\sqrt{x - 1} - 1} + \color{blue}{\sqrt{x} \cdot \sqrt{4}}$
4. Final simplification0.1

$\leadsto \sqrt{\sqrt{x - 1} - 1} + \sqrt{x} \cdot \sqrt{4}$

# Reproduce

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