Average Error: 47.4 → 0.2
Time: 20.5s
Precision: 64
$\sqrt{x - y} - \sqrt{x - y \cdot y}$
$\frac{{y}^{2}}{\sqrt{x - y} + \sqrt{x - y \cdot y}} - \frac{y}{\sqrt{x - y} + \sqrt{x - y \cdot y}}$
\sqrt{x - y} - \sqrt{x - y \cdot y}
\frac{{y}^{2}}{\sqrt{x - y} + \sqrt{x - y \cdot y}} - \frac{y}{\sqrt{x - y} + \sqrt{x - y \cdot y}}
double f(double x, double y) {
double r1671748 = x;
double r1671749 = y;
double r1671750 = r1671748 - r1671749;
double r1671751 = sqrt(r1671750);
double r1671752 = r1671749 * r1671749;
double r1671753 = r1671748 - r1671752;
double r1671754 = sqrt(r1671753);
double r1671755 = r1671751 - r1671754;
return r1671755;
}


double f(double x, double y) {
double r1671756 = y;
double r1671757 = 2.0;
double r1671758 = pow(r1671756, r1671757);
double r1671759 = x;
double r1671760 = r1671759 - r1671756;
double r1671761 = sqrt(r1671760);
double r1671762 = r1671756 * r1671756;
double r1671763 = r1671759 - r1671762;
double r1671764 = sqrt(r1671763);
double r1671765 = r1671761 + r1671764;
double r1671766 = r1671758 / r1671765;
double r1671767 = r1671756 / r1671765;
double r1671768 = r1671766 - r1671767;
return r1671768;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 47.4

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

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

$\leadsto \frac{\color{blue}{y \cdot y + \left(\left(-y\right) + 0\right)}}{\sqrt{x - y} + \sqrt{x - y \cdot y}}$
5. Using strategy rm
6. Applied neg-sub00.2

$\leadsto \frac{y \cdot y + \left(\color{blue}{\left(0 - y\right)} + 0\right)}{\sqrt{x - y} + \sqrt{x - y \cdot y}}$
7. Applied associate-+l-0.2

$\leadsto \frac{y \cdot y + \color{blue}{\left(0 - \left(y - 0\right)\right)}}{\sqrt{x - y} + \sqrt{x - y \cdot y}}$
8. Applied associate-+r-0.2

$\leadsto \frac{\color{blue}{\left(y \cdot y + 0\right) - \left(y - 0\right)}}{\sqrt{x - y} + \sqrt{x - y \cdot y}}$
9. Applied div-sub0.2

$\leadsto \color{blue}{\frac{y \cdot y + 0}{\sqrt{x - y} + \sqrt{x - y \cdot y}} - \frac{y - 0}{\sqrt{x - y} + \sqrt{x - y \cdot y}}}$
10. Simplified0.2

$\leadsto \color{blue}{\frac{{y}^{2}}{\sqrt{x - y} + \sqrt{x - y \cdot y}}} - \frac{y - 0}{\sqrt{x - y} + \sqrt{x - y \cdot y}}$
11. Simplified0.2

$\leadsto \frac{{y}^{2}}{\sqrt{x - y} + \sqrt{x - y \cdot y}} - \color{blue}{\frac{y}{\sqrt{x - y} + \sqrt{x - y \cdot y}}}$
12. Final simplification0.2

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

# Reproduce

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