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



Bits error versus x
Results
Initial program 0.5
Taylor expanded in x around inf 0.3
Simplified0.3
Final simplification0.3
herbie shell --seed 2022155
(FPCore (x)
:name "sqrt times"
:precision binary64
(* (sqrt (- x 1.0)) (sqrt x)))