Average Error: 34.6 → 0.4
Time: 9.8s
Precision: 64
$\sqrt{x - y} - \sqrt{x}$
$\frac{-1}{\sqrt{x - y} + \sqrt{x}} \cdot y$
\sqrt{x - y} - \sqrt{x}
\frac{-1}{\sqrt{x - y} + \sqrt{x}} \cdot y
double f(double x, double y) {
double r1650553 = x;
double r1650554 = y;
double r1650555 = r1650553 - r1650554;
double r1650556 = sqrt(r1650555);
double r1650557 = sqrt(r1650553);
double r1650558 = r1650556 - r1650557;
return r1650558;
}


double f(double x, double y) {
double r1650559 = -1.0;
double r1650560 = x;
double r1650561 = y;
double r1650562 = r1650560 - r1650561;
double r1650563 = sqrt(r1650562);
double r1650564 = sqrt(r1650560);
double r1650565 = r1650563 + r1650564;
double r1650566 = r1650559 / r1650565;
double r1650567 = r1650566 * r1650561;
return r1650567;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 34.6

$\sqrt{x - y} - \sqrt{x}$
2. Using strategy rm
3. Applied flip--34.7

$\leadsto \color{blue}{\frac{\sqrt{x - y} \cdot \sqrt{x - y} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x - y} + \sqrt{x}}}$
4. Simplified0.3

$\leadsto \frac{\color{blue}{\left(-y\right) + 0}}{\sqrt{x - y} + \sqrt{x}}$
5. Using strategy rm
6. Applied div-inv0.4

$\leadsto \color{blue}{\left(\left(-y\right) + 0\right) \cdot \frac{1}{\sqrt{x - y} + \sqrt{x}}}$
7. Final simplification0.4

$\leadsto \frac{-1}{\sqrt{x - y} + \sqrt{x}} \cdot y$

# Reproduce

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