Average Error: 0.0 → 0.0
Time: 8.2s
Precision: 64
$\left(\left(\sqrt{x} + 1\right) + 1\right) + \mathsf{max}\left(x, y\right)$
$\left(\sqrt{x} + \left(1 + 1\right)\right) + \mathsf{max}\left(x, y\right)$
\left(\left(\sqrt{x} + 1\right) + 1\right) + \mathsf{max}\left(x, y\right)
\left(\sqrt{x} + \left(1 + 1\right)\right) + \mathsf{max}\left(x, y\right)
double f(double x, double y) {
double r1696611 = x;
double r1696612 = sqrt(r1696611);
double r1696613 = 1.0;
double r1696614 = r1696612 + r1696613;
double r1696615 = r1696614 + r1696613;
double r1696616 = y;
double r1696617 = fmax(r1696611, r1696616);
double r1696618 = r1696615 + r1696617;
return r1696618;
}


double f(double x, double y) {
double r1696619 = x;
double r1696620 = sqrt(r1696619);
double r1696621 = 1.0;
double r1696622 = r1696621 + r1696621;
double r1696623 = r1696620 + r1696622;
double r1696624 = y;
double r1696625 = fmax(r1696619, r1696624);
double r1696626 = r1696623 + r1696625;
return r1696626;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 0.0

$\left(\left(\sqrt{x} + 1\right) + 1\right) + \mathsf{max}\left(x, y\right)$
2. Using strategy rm
3. Applied associate-+l+0.0

$\leadsto \color{blue}{\left(\sqrt{x} + \left(1 + 1\right)\right)} + \mathsf{max}\left(x, y\right)$
4. Final simplification0.0

$\leadsto \left(\sqrt{x} + \left(1 + 1\right)\right) + \mathsf{max}\left(x, y\right)$

# Reproduce

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