# ?

Average Error: 58.6 → 0.0
Time: 7.0s
Precision: binary64
Cost: 6976

# ?

$0 \leq x \land x \leq 1$
$\sqrt{x + 1} - 1$
$x \cdot \frac{1}{1 + \sqrt{x + 1}}$
(FPCore (x) :precision binary64 (- (sqrt (+ x 1.0)) 1.0))
(FPCore (x) :precision binary64 (* x (/ 1.0 (+ 1.0 (sqrt (+ x 1.0))))))
double code(double x) {
return sqrt((x + 1.0)) - 1.0;
}

double code(double x) {
return x * (1.0 / (1.0 + sqrt((x + 1.0))));
}

real(8) function code(x)
real(8), intent (in) :: x
code = sqrt((x + 1.0d0)) - 1.0d0
end function

real(8) function code(x)
real(8), intent (in) :: x
code = x * (1.0d0 / (1.0d0 + sqrt((x + 1.0d0))))
end function

public static double code(double x) {
return Math.sqrt((x + 1.0)) - 1.0;
}

public static double code(double x) {
return x * (1.0 / (1.0 + Math.sqrt((x + 1.0))));
}

def code(x):
return math.sqrt((x + 1.0)) - 1.0

def code(x):
return x * (1.0 / (1.0 + math.sqrt((x + 1.0))))

function code(x)
return Float64(sqrt(Float64(x + 1.0)) - 1.0)
end

function code(x)
return Float64(x * Float64(1.0 / Float64(1.0 + sqrt(Float64(x + 1.0)))))
end

function tmp = code(x)
tmp = sqrt((x + 1.0)) - 1.0;
end

function tmp = code(x)
tmp = x * (1.0 / (1.0 + sqrt((x + 1.0))));
end

code[x_] := N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]],$MachinePrecision] - 1.0), $MachinePrecision]  code[x_] := N[(x * N[(1.0 / N[(1.0 + N[Sqrt[N[(x + 1.0),$MachinePrecision]], $MachinePrecision]),$MachinePrecision]), $MachinePrecision]),$MachinePrecision]

\sqrt{x + 1} - 1

x \cdot \frac{1}{1 + \sqrt{x + 1}}


# Try it out?

Results

 In Out
Enter valid numbers for all inputs

# Derivation?

1. Initial program 58.6

$\sqrt{x + 1} - 1$
2. Applied egg-rr0.0

$\leadsto \color{blue}{x \cdot \frac{1}{1 + \sqrt{x + 1}}}$
3. Final simplification0.0

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

# Alternatives

Alternative 1
Error0.0
Cost6848
$\frac{x}{1 + \sqrt{x + 1}}$
Alternative 2
Error0.6
Cost448
$x \cdot \left(0.5 + x \cdot -0.125\right)$
Alternative 3
Error0.6
Cost448
$\frac{x}{x \cdot 0.5 + 2}$
Alternative 4
Error1.3
Cost192
$x \cdot 0.5$

# Reproduce?

herbie shell --seed 1
(FPCore (x)
:name "sqrt(x+1)-1"
:precision binary64
:pre (and (<= 0.0 x) (<= x 1.0))
(- (sqrt (+ x 1.0)) 1.0))