?

Average Error: 30.1 → 29.4
Time: 27.2s
Precision: binary64
Cost: 13376

?

\[\sqrt{x + 1} - \sqrt{x} \]
\[\left(\sqrt{1 + x} - \left(\sqrt{x} - -1\right)\right) + 1 \]
(FPCore (x) :precision binary64 (- (sqrt (+ x 1.0)) (sqrt x)))
(FPCore (x) :precision binary64 (+ (- (sqrt (+ 1.0 x)) (- (sqrt x) -1.0)) 1.0))
double code(double x) {
	return sqrt((x + 1.0)) - sqrt(x);
}
double code(double x) {
	return (sqrt((1.0 + x)) - (sqrt(x) - -1.0)) + 1.0;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = sqrt((x + 1.0d0)) - sqrt(x)
end function
real(8) function code(x)
    real(8), intent (in) :: x
    code = (sqrt((1.0d0 + x)) - (sqrt(x) - (-1.0d0))) + 1.0d0
end function
public static double code(double x) {
	return Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
public static double code(double x) {
	return (Math.sqrt((1.0 + x)) - (Math.sqrt(x) - -1.0)) + 1.0;
}
def code(x):
	return math.sqrt((x + 1.0)) - math.sqrt(x)
def code(x):
	return (math.sqrt((1.0 + x)) - (math.sqrt(x) - -1.0)) + 1.0
function code(x)
	return Float64(sqrt(Float64(x + 1.0)) - sqrt(x))
end
function code(x)
	return Float64(Float64(sqrt(Float64(1.0 + x)) - Float64(sqrt(x) - -1.0)) + 1.0)
end
function tmp = code(x)
	tmp = sqrt((x + 1.0)) - sqrt(x);
end
function tmp = code(x)
	tmp = (sqrt((1.0 + x)) - (sqrt(x) - -1.0)) + 1.0;
end
code[x_] := N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
code[x_] := N[(N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]
\sqrt{x + 1} - \sqrt{x}
\left(\sqrt{1 + x} - \left(\sqrt{x} - -1\right)\right) + 1

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original30.1
Target0.2
Herbie29.4
\[\frac{1}{\sqrt{x + 1} + \sqrt{x}} \]

Derivation?

  1. Initial program 30.1

    \[\sqrt{x + 1} - \sqrt{x} \]
  2. Applied egg-rr31.3

    \[\leadsto \color{blue}{\frac{1}{\sqrt{x + 1} - \sqrt{x}} \cdot \left(\left(\sqrt{x + 1} - \sqrt{x}\right) \cdot \left(\sqrt{x + 1} - \sqrt{x}\right)\right)} \]
  3. Applied egg-rr29.4

    \[\leadsto \color{blue}{\left(\sqrt{1 + x} - \left(\sqrt{x} - -1\right)\right) + 1} \]
  4. Final simplification29.4

    \[\leadsto \left(\sqrt{1 + x} - \left(\sqrt{x} - -1\right)\right) + 1 \]

Alternatives

Alternative 1
Error30.1
Cost13120
\[\sqrt{x + 1} - \sqrt{x} \]
Alternative 2
Error31.4
Cost64
\[1 \]

Error

Reproduce?

herbie shell --seed 2023077 
(FPCore (x)
  :name "Main:bigenough3 from C"
  :precision binary64

  :herbie-target
  (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))

  (- (sqrt (+ x 1.0)) (sqrt x)))