Average Error: 0.0 → 0.0
Time: 4.3s
Precision: 64
$\sqrt{\frac{x}{x + 1}}$
$\left|\sqrt{\frac{x}{x + 1}}\right|$
\sqrt{\frac{x}{x + 1}}
\left|\sqrt{\frac{x}{x + 1}}\right|
double f(double x) {
double r2441091 = x;
double r2441092 = 1.0;
double r2441093 = r2441091 + r2441092;
double r2441094 = r2441091 / r2441093;
double r2441095 = sqrt(r2441094);
return r2441095;
}


double f(double x) {
double r2441096 = x;
double r2441097 = 1.0;
double r2441098 = r2441096 + r2441097;
double r2441099 = r2441096 / r2441098;
double r2441100 = sqrt(r2441099);
double r2441101 = fabs(r2441100);
return r2441101;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 0.0

$\sqrt{\frac{x}{x + 1}}$
2. Using strategy rm

$\leadsto \sqrt{\color{blue}{\sqrt{\frac{x}{x + 1}} \cdot \sqrt{\frac{x}{x + 1}}}}$
4. Applied rem-sqrt-square0.0

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

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

# Reproduce

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