?

Average Error: 19.4 → 19.4
Time: 19.6s
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.4
Target0.6
Herbie19.4
\[\frac{1}{\left(x + 1\right) \cdot \sqrt{x} + x \cdot \sqrt{x + 1}} \]

Derivation?

  1. Initial program 19.4

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

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

Alternatives

Alternative 1
Error20.3
Cost7232
\[\left(\frac{1}{\sqrt{x}} + \left(1 - \frac{2}{x + 2}\right)\right) + -1 \]
Alternative 2
Error20.3
Cost7232
\[\left(1 - \frac{2}{x + 2}\right) + \left(\frac{1}{\sqrt{x}} - 1\right) \]
Alternative 3
Error20.3
Cost7108
\[\begin{array}{l} t_0 := \frac{1}{\sqrt{x}}\\ \mathbf{if}\;x \leq 8 \cdot 10^{+76}:\\ \;\;\;\;t_0 - \left(-0.5 \cdot x + 1\right)\\ \mathbf{else}:\\ \;\;\;\;1 + \left(t_0 - 1\right)\\ \end{array} \]
Alternative 4
Error20.1
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}:\\ \;\;\;\;1 + \left(t_0 - 1\right)\\ \end{array} \]
Alternative 5
Error20.7
Cost6852
\[\begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;\frac{1}{\sqrt{x}} - 1\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 6
Error21.4
Cost6848
\[1 + \left(\frac{1}{\sqrt{x}} - 1\right) \]
Alternative 7
Error61.5
Cost192
\[0.5 \cdot x \]
Alternative 8
Error51.9
Cost64
\[0 \]

Error

Reproduce?

herbie shell --seed 2023075 
(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)))))