Average Error: 0.0 → 0.0
Time: 4.5s
Precision: binary64
Cost: 13120
$\left(-1.79 \cdot 10^{+308} \leq x \land x \leq 1.79 \cdot 10^{+308}\right) \land \left(-1 \leq X \land X \leq 1000000000\right)$
$\sqrt{x + 1} - \sqrt{X}$
$\sqrt{x + 1} - \sqrt{X}$
(FPCore (x X) :precision binary64 (- (sqrt (+ x 1.0)) (sqrt X)))
(FPCore (x X) :precision binary64 (- (sqrt (+ x 1.0)) (sqrt X)))
double code(double x, double X) {
return sqrt((x + 1.0)) - sqrt(X);
}

double code(double x, double X) {
return sqrt((x + 1.0)) - sqrt(X);
}

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

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

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

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

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

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

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

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

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

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

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

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

\sqrt{x + 1} - \sqrt{X}

\sqrt{x + 1} - \sqrt{X}


Try it out

Results

 In Out
Enter valid numbers for all inputs

Derivation

1. Initial program 0.0

$\sqrt{x + 1} - \sqrt{X}$
2. Final simplification0.0

$\leadsto \sqrt{x + 1} - \sqrt{X}$

Alternatives

Alternative 1
Error0.4
Cost6980
$\begin{array}{l} \mathbf{if}\;x \leq 5.841605225893026 \cdot 10^{-14}:\\ \;\;\;\;\left(1 + x \cdot 0.5\right) - \sqrt{X}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x + 1}\\ \end{array}$
Alternative 2
Error0.7
Cost6724
$\begin{array}{l} \mathbf{if}\;x \leq 1.780146019877377 \cdot 10^{-22}:\\ \;\;\;\;1 - \sqrt{X}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x + 1}\\ \end{array}$
Alternative 3
Error20.7
Cost6592
$1 - \sqrt{X}$
Alternative 4
Error23.0
Cost320
$1 + x \cdot 0.5$
Alternative 5
Error23.5
Cost64
$1$

Reproduce

herbie shell --seed 1
(FPCore (x X)
:name "sqrt(x+1)-sqrt(X)"
:precision binary64
:pre (and (and (<= -1.79e+308 x) (<= x 1.79e+308)) (and (<= -1.0 X) (<= X 1000000000.0)))
(- (sqrt (+ x 1.0)) (sqrt X)))