
(FPCore (x) :precision binary64 (- (sqrt (+ x 1.0)) (sqrt x)))
double code(double x) {
return sqrt((x + 1.0)) - sqrt(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = sqrt((x + 1.0d0)) - sqrt(x)
end function
public static double code(double x) {
return Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
def code(x): return math.sqrt((x + 1.0)) - math.sqrt(x)
function code(x) return Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) end
function tmp = code(x) tmp = sqrt((x + 1.0)) - sqrt(x); end
code[x_] := N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{x + 1} - \sqrt{x}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (- (sqrt (+ x 1.0)) (sqrt x)))
double code(double x) {
return sqrt((x + 1.0)) - sqrt(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = sqrt((x + 1.0d0)) - sqrt(x)
end function
public static double code(double x) {
return Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
def code(x): return math.sqrt((x + 1.0)) - math.sqrt(x)
function code(x) return Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) end
function tmp = code(x) tmp = sqrt((x + 1.0)) - sqrt(x); end
code[x_] := N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{x + 1} - \sqrt{x}
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (/ -0.125 (sqrt x))))
(if (<= x 1000.0)
(- (sqrt (+ x 1.0)) (sqrt x))
(fma
(/ (fma (sqrt x) 0.5 t_0) (- (* (sqrt x) 0.5) t_0))
(- (* (pow x -0.5) 0.5) (* (pow x -1.5) -0.125))
(/ (fma 0.0625 (pow x -1.5) (* -0.0390625 (pow x -2.5))) x)))))
double code(double x) {
double t_0 = -0.125 / sqrt(x);
double tmp;
if (x <= 1000.0) {
tmp = sqrt((x + 1.0)) - sqrt(x);
} else {
tmp = fma((fma(sqrt(x), 0.5, t_0) / ((sqrt(x) * 0.5) - t_0)), ((pow(x, -0.5) * 0.5) - (pow(x, -1.5) * -0.125)), (fma(0.0625, pow(x, -1.5), (-0.0390625 * pow(x, -2.5))) / x));
}
return tmp;
}
function code(x) t_0 = Float64(-0.125 / sqrt(x)) tmp = 0.0 if (x <= 1000.0) tmp = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)); else tmp = fma(Float64(fma(sqrt(x), 0.5, t_0) / Float64(Float64(sqrt(x) * 0.5) - t_0)), Float64(Float64((x ^ -0.5) * 0.5) - Float64((x ^ -1.5) * -0.125)), Float64(fma(0.0625, (x ^ -1.5), Float64(-0.0390625 * (x ^ -2.5))) / x)); end return tmp end
code[x_] := Block[{t$95$0 = N[(-0.125 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1000.0], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[x], $MachinePrecision] * 0.5 + t$95$0), $MachinePrecision] / N[(N[(N[Sqrt[x], $MachinePrecision] * 0.5), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[x, -0.5], $MachinePrecision] * 0.5), $MachinePrecision] - N[(N[Power[x, -1.5], $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] + N[(N[(0.0625 * N[Power[x, -1.5], $MachinePrecision] + N[(-0.0390625 * N[Power[x, -2.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-0.125}{\sqrt{x}}\\
\mathbf{if}\;x \leq 1000:\\
\;\;\;\;\sqrt{x + 1} - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(\sqrt{x}, 0.5, t\_0\right)}{\sqrt{x} \cdot 0.5 - t\_0}, {x}^{-0.5} \cdot 0.5 - {x}^{-1.5} \cdot -0.125, \frac{\mathsf{fma}\left(0.0625, {x}^{-1.5}, -0.0390625 \cdot {x}^{-2.5}\right)}{x}\right)\\
\end{array}
\end{array}
if x < 1e3Initial program 99.8%
if 1e3 < x Initial program 5.5%
Taylor expanded in x around inf
lower-/.f64N/A
Applied rewrites99.6%
Applied rewrites100.0%
(FPCore (x)
:precision binary64
(if (<= x 1000.0)
(- (sqrt (+ x 1.0)) (sqrt x))
(fma
(pow x -3.5)
-0.0390625
(/ (fma 0.0625 (pow x -1.5) (fma (sqrt x) 0.5 (/ -0.125 (sqrt x)))) x))))
double code(double x) {
double tmp;
if (x <= 1000.0) {
tmp = sqrt((x + 1.0)) - sqrt(x);
} else {
tmp = fma(pow(x, -3.5), -0.0390625, (fma(0.0625, pow(x, -1.5), fma(sqrt(x), 0.5, (-0.125 / sqrt(x)))) / x));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1000.0) tmp = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)); else tmp = fma((x ^ -3.5), -0.0390625, Float64(fma(0.0625, (x ^ -1.5), fma(sqrt(x), 0.5, Float64(-0.125 / sqrt(x)))) / x)); end return tmp end
code[x_] := If[LessEqual[x, 1000.0], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -3.5], $MachinePrecision] * -0.0390625 + N[(N[(0.0625 * N[Power[x, -1.5], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] * 0.5 + N[(-0.125 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1000:\\
\;\;\;\;\sqrt{x + 1} - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left({x}^{-3.5}, -0.0390625, \frac{\mathsf{fma}\left(0.0625, {x}^{-1.5}, \mathsf{fma}\left(\sqrt{x}, 0.5, \frac{-0.125}{\sqrt{x}}\right)\right)}{x}\right)\\
\end{array}
\end{array}
if x < 1e3Initial program 99.8%
if 1e3 < x Initial program 5.5%
Taylor expanded in x around inf
lower-/.f64N/A
Applied rewrites99.6%
Applied rewrites99.6%
(FPCore (x) :precision binary64 (if (<= x 53000000.0) (- (sqrt (+ x 1.0)) (sqrt x)) (* (sqrt (pow x -1.0)) 0.5)))
double code(double x) {
double tmp;
if (x <= 53000000.0) {
tmp = sqrt((x + 1.0)) - sqrt(x);
} else {
tmp = sqrt(pow(x, -1.0)) * 0.5;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 53000000.0d0) then
tmp = sqrt((x + 1.0d0)) - sqrt(x)
else
tmp = sqrt((x ** (-1.0d0))) * 0.5d0
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 53000000.0) {
tmp = Math.sqrt((x + 1.0)) - Math.sqrt(x);
} else {
tmp = Math.sqrt(Math.pow(x, -1.0)) * 0.5;
}
return tmp;
}
def code(x): tmp = 0 if x <= 53000000.0: tmp = math.sqrt((x + 1.0)) - math.sqrt(x) else: tmp = math.sqrt(math.pow(x, -1.0)) * 0.5 return tmp
function code(x) tmp = 0.0 if (x <= 53000000.0) tmp = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)); else tmp = Float64(sqrt((x ^ -1.0)) * 0.5); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 53000000.0) tmp = sqrt((x + 1.0)) - sqrt(x); else tmp = sqrt((x ^ -1.0)) * 0.5; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 53000000.0], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[Power[x, -1.0], $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 53000000:\\
\;\;\;\;\sqrt{x + 1} - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{{x}^{-1}} \cdot 0.5\\
\end{array}
\end{array}
if x < 5.3e7Initial program 99.7%
if 5.3e7 < x Initial program 4.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6499.3
Applied rewrites99.3%
Final simplification99.5%
(FPCore (x) :precision binary64 (if (<= x 1.25) (fma (fma -0.125 x 0.5) x (- 1.0 (sqrt x))) (* (sqrt (pow x -1.0)) 0.5)))
double code(double x) {
double tmp;
if (x <= 1.25) {
tmp = fma(fma(-0.125, x, 0.5), x, (1.0 - sqrt(x)));
} else {
tmp = sqrt(pow(x, -1.0)) * 0.5;
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1.25) tmp = fma(fma(-0.125, x, 0.5), x, Float64(1.0 - sqrt(x))); else tmp = Float64(sqrt((x ^ -1.0)) * 0.5); end return tmp end
code[x_] := If[LessEqual[x, 1.25], N[(N[(-0.125 * x + 0.5), $MachinePrecision] * x + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[Power[x, -1.0], $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.25:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.125, x, 0.5\right), x, 1 - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{{x}^{-1}} \cdot 0.5\\
\end{array}
\end{array}
if x < 1.25Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-sqrt.f6499.8
Applied rewrites99.8%
if 1.25 < x Initial program 7.4%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6497.5
Applied rewrites97.5%
Final simplification98.5%
(FPCore (x) :precision binary64 (if (<= x 180000.0) (- (sqrt (+ x 1.0)) (sqrt x)) (/ (fma (sqrt x) 0.5 (/ -0.125 (sqrt x))) x)))
double code(double x) {
double tmp;
if (x <= 180000.0) {
tmp = sqrt((x + 1.0)) - sqrt(x);
} else {
tmp = fma(sqrt(x), 0.5, (-0.125 / sqrt(x))) / x;
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 180000.0) tmp = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)); else tmp = Float64(fma(sqrt(x), 0.5, Float64(-0.125 / sqrt(x))) / x); end return tmp end
code[x_] := If[LessEqual[x, 180000.0], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[x], $MachinePrecision] * 0.5 + N[(-0.125 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 180000:\\
\;\;\;\;\sqrt{x + 1} - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\sqrt{x}, 0.5, \frac{-0.125}{\sqrt{x}}\right)}{x}\\
\end{array}
\end{array}
if x < 1.8e5Initial program 99.7%
if 1.8e5 < x Initial program 4.9%
Taylor expanded in x around inf
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f6499.6
Applied rewrites99.6%
Applied rewrites99.6%
(FPCore (x) :precision binary64 (if (<= (- (sqrt (+ x 1.0)) (sqrt x)) 0.05) (- (* 0.5 x) (sqrt x)) (- 1.0 (sqrt x))))
double code(double x) {
double tmp;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.05) {
tmp = (0.5 * x) - sqrt(x);
} else {
tmp = 1.0 - sqrt(x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if ((sqrt((x + 1.0d0)) - sqrt(x)) <= 0.05d0) then
tmp = (0.5d0 * x) - sqrt(x)
else
tmp = 1.0d0 - sqrt(x)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) <= 0.05) {
tmp = (0.5 * x) - Math.sqrt(x);
} else {
tmp = 1.0 - Math.sqrt(x);
}
return tmp;
}
def code(x): tmp = 0 if (math.sqrt((x + 1.0)) - math.sqrt(x)) <= 0.05: tmp = (0.5 * x) - math.sqrt(x) else: tmp = 1.0 - math.sqrt(x) return tmp
function code(x) tmp = 0.0 if (Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) <= 0.05) tmp = Float64(Float64(0.5 * x) - sqrt(x)); else tmp = Float64(1.0 - sqrt(x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.05) tmp = (0.5 * x) - sqrt(x); else tmp = 1.0 - sqrt(x); end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.05], N[(N[(0.5 * x), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 0.05:\\
\;\;\;\;0.5 \cdot x - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;1 - \sqrt{x}\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 0.050000000000000003Initial program 7.4%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f644.6
Applied rewrites4.6%
Taylor expanded in x around inf
Applied rewrites4.6%
if 0.050000000000000003 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites98.6%
(FPCore (x) :precision binary64 (if (<= x 1.25) (fma (fma -0.125 x 0.5) x (- 1.0 (sqrt x))) (/ 0.5 (sqrt x))))
double code(double x) {
double tmp;
if (x <= 1.25) {
tmp = fma(fma(-0.125, x, 0.5), x, (1.0 - sqrt(x)));
} else {
tmp = 0.5 / sqrt(x);
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1.25) tmp = fma(fma(-0.125, x, 0.5), x, Float64(1.0 - sqrt(x))); else tmp = Float64(0.5 / sqrt(x)); end return tmp end
code[x_] := If[LessEqual[x, 1.25], N[(N[(-0.125 * x + 0.5), $MachinePrecision] * x + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.25:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.125, x, 0.5\right), x, 1 - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\sqrt{x}}\\
\end{array}
\end{array}
if x < 1.25Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-sqrt.f6499.8
Applied rewrites99.8%
if 1.25 < x Initial program 7.4%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6497.5
Applied rewrites97.5%
Applied rewrites97.3%
(FPCore (x) :precision binary64 (if (<= x 1.0) (fma 0.5 x (- 1.0 (sqrt x))) (/ 0.5 (sqrt x))))
double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = fma(0.5, x, (1.0 - sqrt(x)));
} else {
tmp = 0.5 / sqrt(x);
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1.0) tmp = fma(0.5, x, Float64(1.0 - sqrt(x))); else tmp = Float64(0.5 / sqrt(x)); end return tmp end
code[x_] := If[LessEqual[x, 1.0], N[(0.5 * x + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\mathsf{fma}\left(0.5, x, 1 - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\sqrt{x}}\\
\end{array}
\end{array}
if x < 1Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
associate--l+N/A
lower-fma.f64N/A
lower--.f64N/A
lower-sqrt.f6499.3
Applied rewrites99.3%
if 1 < x Initial program 7.4%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6497.5
Applied rewrites97.5%
Applied rewrites97.3%
(FPCore (x) :precision binary64 (fma 0.5 x (- 1.0 (sqrt x))))
double code(double x) {
return fma(0.5, x, (1.0 - sqrt(x)));
}
function code(x) return fma(0.5, x, Float64(1.0 - sqrt(x))) end
code[x_] := N[(0.5 * x + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(0.5, x, 1 - \sqrt{x}\right)
\end{array}
Initial program 49.0%
Taylor expanded in x around 0
+-commutativeN/A
associate--l+N/A
lower-fma.f64N/A
lower--.f64N/A
lower-sqrt.f6447.1
Applied rewrites47.1%
(FPCore (x) :precision binary64 (- 1.0 (sqrt x)))
double code(double x) {
return 1.0 - sqrt(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0 - sqrt(x)
end function
public static double code(double x) {
return 1.0 - Math.sqrt(x);
}
def code(x): return 1.0 - math.sqrt(x)
function code(x) return Float64(1.0 - sqrt(x)) end
function tmp = code(x) tmp = 1.0 - sqrt(x); end
code[x_] := N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \sqrt{x}
\end{array}
Initial program 49.0%
Taylor expanded in x around 0
Applied rewrites45.1%
(FPCore (x) :precision binary64 (* (* x x) -0.125))
double code(double x) {
return (x * x) * -0.125;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (x * x) * (-0.125d0)
end function
public static double code(double x) {
return (x * x) * -0.125;
}
def code(x): return (x * x) * -0.125
function code(x) return Float64(Float64(x * x) * -0.125) end
function tmp = code(x) tmp = (x * x) * -0.125; end
code[x_] := N[(N[(x * x), $MachinePrecision] * -0.125), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot x\right) \cdot -0.125
\end{array}
Initial program 49.0%
Taylor expanded in x around 0
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-sqrt.f6445.4
Applied rewrites45.4%
Taylor expanded in x around inf
Applied rewrites1.8%
(FPCore (x) :precision binary64 (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))))
double code(double x) {
return 1.0 / (sqrt((x + 1.0)) + sqrt(x));
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))
end function
public static double code(double x) {
return 1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x));
}
def code(x): return 1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))
function code(x) return Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) end
function tmp = code(x) tmp = 1.0 / (sqrt((x + 1.0)) + sqrt(x)); end
code[x_] := N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{x + 1} + \sqrt{x}}
\end{array}
herbie shell --seed 2024337
(FPCore (x)
:name "Main:bigenough3 from C"
:precision binary64
:alt
(! :herbie-platform default (/ 1 (+ (sqrt (+ x 1)) (sqrt x))))
(- (sqrt (+ x 1.0)) (sqrt x)))