?

Average Error: 29.8 → 29.2
Time: 8.8s
Precision: binary64
Cost: 26944

?

\[\sqrt{x + 1} - \sqrt{x} \]
\[\left(1 - \frac{\sqrt{x + 1} - \sqrt{x}}{-2}\right) + \left(\sqrt{1 + x} \cdot 0.5 - \left(\sqrt{x} \cdot 0.5 - -1\right)\right) \]
(FPCore (x) :precision binary64 (- (sqrt (+ x 1.0)) (sqrt x)))
(FPCore (x)
 :precision binary64
 (+
  (- 1.0 (/ (- (sqrt (+ x 1.0)) (sqrt x)) -2.0))
  (- (* (sqrt (+ 1.0 x)) 0.5) (- (* (sqrt x) 0.5) -1.0))))
double code(double x) {
	return sqrt((x + 1.0)) - sqrt(x);
}
double code(double x) {
	return (1.0 - ((sqrt((x + 1.0)) - sqrt(x)) / -2.0)) + ((sqrt((1.0 + x)) * 0.5) - ((sqrt(x) * 0.5) - -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 = (1.0d0 - ((sqrt((x + 1.0d0)) - sqrt(x)) / (-2.0d0))) + ((sqrt((1.0d0 + x)) * 0.5d0) - ((sqrt(x) * 0.5d0) - (-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 (1.0 - ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) / -2.0)) + ((Math.sqrt((1.0 + x)) * 0.5) - ((Math.sqrt(x) * 0.5) - -1.0));
}
def code(x):
	return math.sqrt((x + 1.0)) - math.sqrt(x)
def code(x):
	return (1.0 - ((math.sqrt((x + 1.0)) - math.sqrt(x)) / -2.0)) + ((math.sqrt((1.0 + x)) * 0.5) - ((math.sqrt(x) * 0.5) - -1.0))
function code(x)
	return Float64(sqrt(Float64(x + 1.0)) - sqrt(x))
end
function code(x)
	return Float64(Float64(1.0 - Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) / -2.0)) + Float64(Float64(sqrt(Float64(1.0 + x)) * 0.5) - Float64(Float64(sqrt(x) * 0.5) - -1.0)))
end
function tmp = code(x)
	tmp = sqrt((x + 1.0)) - sqrt(x);
end
function tmp = code(x)
	tmp = (1.0 - ((sqrt((x + 1.0)) - sqrt(x)) / -2.0)) + ((sqrt((1.0 + x)) * 0.5) - ((sqrt(x) * 0.5) - -1.0));
end
code[x_] := N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
code[x_] := N[(N[(1.0 - N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] / -2.0), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision] - N[(N[(N[Sqrt[x], $MachinePrecision] * 0.5), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\sqrt{x + 1} - \sqrt{x}
\left(1 - \frac{\sqrt{x + 1} - \sqrt{x}}{-2}\right) + \left(\sqrt{1 + x} \cdot 0.5 - \left(\sqrt{x} \cdot 0.5 - -1\right)\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original29.8
Target0.2
Herbie29.2
\[\frac{1}{\sqrt{x + 1} + \sqrt{x}} \]

Derivation?

  1. Initial program 29.8

    \[\sqrt{x + 1} - \sqrt{x} \]
  2. Applied egg-rr29.9

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

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

    \[\leadsto \left(1 - \frac{\sqrt{x + 1} - \sqrt{x}}{-2}\right) + \left(\sqrt{1 + x} \cdot 0.5 - \left(\sqrt{x} \cdot 0.5 - -1\right)\right) \]

Alternatives

Alternative 1
Error29.8
Cost26688
\[\begin{array}{l} t_0 := \sqrt{1 + x}\\ 0.5 \cdot \left(\left(\left(\left(1 + t_0\right) + -1\right) - \left(\sqrt{x} - t_0\right)\right) - \sqrt{x}\right) \end{array} \]
Alternative 2
Error29.8
Cost13120
\[\sqrt{x + 1} - \sqrt{x} \]
Alternative 3
Error30.8
Cost6848
\[0.5 \cdot x + \left(1 - \sqrt{x}\right) \]
Alternative 4
Error55.8
Cost64
\[0.5 \]
Alternative 5
Error31.1
Cost64
\[1 \]

Error

Reproduce?

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