?

Average Error: 19.8 → 19.8
Time: 22.0s
Precision: binary64
Cost: 13376

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original19.8
Target0.6
Herbie19.8
\[\frac{1}{\left(x + 1\right) \cdot \sqrt{x} + x \cdot \sqrt{x + 1}} \]

Derivation?

  1. Initial program 19.8

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Final simplification19.8

    \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]

Alternatives

Alternative 1
Error20.7
Cost7232
\[\left(\frac{1}{\sqrt{x}} + \left(1 - \frac{2}{x + 2}\right)\right) + -1 \]
Alternative 2
Error20.7
Cost7108
\[\begin{array}{l} t_0 := \frac{1}{\sqrt{x}}\\ \mathbf{if}\;x \leq 2:\\ \;\;\;\;t_0 - \left(-0.5 \cdot x + 1\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t_0 + 1\right) + -1\\ \end{array} \]
Alternative 3
Error20.5
Cost7108
\[\begin{array}{l} t_0 := \frac{1}{\sqrt{x}}\\ \mathbf{if}\;x \leq 8.5 \cdot 10^{+122}:\\ \;\;\;\;t_0 - \frac{2}{x + 2}\\ \mathbf{else}:\\ \;\;\;\;\left(t_0 + 1\right) + -1\\ \end{array} \]
Alternative 4
Error21.8
Cost6848
\[\left(\frac{1}{\sqrt{x}} + 1\right) + -1 \]
Alternative 5
Error31.1
Cost6592
\[\frac{1}{\sqrt{x}} \]
Alternative 6
Error62.3
Cost192
\[\frac{-1}{x} \]
Alternative 7
Error62.8
Cost64
\[-1 \]

Error

Reproduce?

herbie shell --seed 2023073 
(FPCore (x)
  :name "2isqrt (example 3.6)"
  :precision binary64

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

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