
(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)));
}
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)));
}
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 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]
\begin{array}{l}
\\
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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)));
}
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)));
}
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 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]
\begin{array}{l}
\\
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\end{array}
(FPCore (x) :precision binary64 (* (pow (* (sqrt x) (+ (sqrt x) (pow (+ x 1.0) 0.5))) -1.0) (pow (+ x 1.0) -0.5)))
double code(double x) {
return pow((sqrt(x) * (sqrt(x) + pow((x + 1.0), 0.5))), -1.0) * pow((x + 1.0), -0.5);
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((sqrt(x) * (sqrt(x) + ((x + 1.0d0) ** 0.5d0))) ** (-1.0d0)) * ((x + 1.0d0) ** (-0.5d0))
end function
public static double code(double x) {
return Math.pow((Math.sqrt(x) * (Math.sqrt(x) + Math.pow((x + 1.0), 0.5))), -1.0) * Math.pow((x + 1.0), -0.5);
}
def code(x): return math.pow((math.sqrt(x) * (math.sqrt(x) + math.pow((x + 1.0), 0.5))), -1.0) * math.pow((x + 1.0), -0.5)
function code(x) return Float64((Float64(sqrt(x) * Float64(sqrt(x) + (Float64(x + 1.0) ^ 0.5))) ^ -1.0) * (Float64(x + 1.0) ^ -0.5)) end
function tmp = code(x) tmp = ((sqrt(x) * (sqrt(x) + ((x + 1.0) ^ 0.5))) ^ -1.0) * ((x + 1.0) ^ -0.5); end
code[x_] := N[(N[Power[N[(N[Sqrt[x], $MachinePrecision] * N[(N[Sqrt[x], $MachinePrecision] + N[Power[N[(x + 1.0), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision] * N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(\sqrt{x} \cdot \left(\sqrt{x} + {\left(x + 1\right)}^{0.5}\right)\right)}^{-1} \cdot {\left(x + 1\right)}^{-0.5}
\end{array}
Initial program 38.3%
clear-numN/A
frac-subN/A
/-rgt-identityN/A
*-lft-identityN/A
metadata-evalN/A
div-invN/A
flip--N/A
*-rgt-identityN/A
metadata-evalN/A
div-invN/A
/-rgt-identityN/A
associate-/l/N/A
Applied egg-rr40.2%
associate--l+N/A
+-inversesN/A
metadata-evalN/A
inv-powN/A
*-commutativeN/A
sqrt-prodN/A
associate-*r*N/A
unpow-prod-downN/A
metadata-evalN/A
pow-powN/A
pow2N/A
rem-square-sqrtN/A
*-lowering-*.f64N/A
Applied egg-rr99.3%
Final simplification99.3%
(FPCore (x) :precision binary64 (/ (pow (+ x 1.0) -0.5) (/ x (+ (/ 0.0625 (* x x)) (+ 0.5 (/ -0.125 x))))))
double code(double x) {
return pow((x + 1.0), -0.5) / (x / ((0.0625 / (x * x)) + (0.5 + (-0.125 / x))));
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((x + 1.0d0) ** (-0.5d0)) / (x / ((0.0625d0 / (x * x)) + (0.5d0 + ((-0.125d0) / x))))
end function
public static double code(double x) {
return Math.pow((x + 1.0), -0.5) / (x / ((0.0625 / (x * x)) + (0.5 + (-0.125 / x))));
}
def code(x): return math.pow((x + 1.0), -0.5) / (x / ((0.0625 / (x * x)) + (0.5 + (-0.125 / x))))
function code(x) return Float64((Float64(x + 1.0) ^ -0.5) / Float64(x / Float64(Float64(0.0625 / Float64(x * x)) + Float64(0.5 + Float64(-0.125 / x))))) end
function tmp = code(x) tmp = ((x + 1.0) ^ -0.5) / (x / ((0.0625 / (x * x)) + (0.5 + (-0.125 / x)))); end
code[x_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision] / N[(x / N[(N[(0.0625 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(0.5 + N[(-0.125 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(x + 1\right)}^{-0.5}}{\frac{x}{\frac{0.0625}{x \cdot x} + \left(0.5 + \frac{-0.125}{x}\right)}}
\end{array}
Initial program 38.3%
clear-numN/A
frac-subN/A
/-rgt-identityN/A
*-lft-identityN/A
metadata-evalN/A
div-invN/A
flip--N/A
*-rgt-identityN/A
metadata-evalN/A
div-invN/A
/-rgt-identityN/A
associate-/l/N/A
Applied egg-rr40.2%
associate--l+N/A
+-inversesN/A
metadata-evalN/A
inv-powN/A
*-commutativeN/A
sqrt-prodN/A
associate-*r*N/A
unpow-prod-downN/A
metadata-evalN/A
pow-powN/A
pow2N/A
rem-square-sqrtN/A
*-lowering-*.f64N/A
Applied egg-rr99.3%
Taylor expanded in x around inf
/-lowering-/.f64N/A
+-commutativeN/A
associate--l+N/A
metadata-evalN/A
associate-*r/N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
associate-*r/N/A
metadata-evalN/A
+-lowering-+.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6498.8%
Simplified98.8%
*-commutativeN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
pow-lowering-pow.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f6499.0%
Applied egg-rr99.0%
(FPCore (x) :precision binary64 (* (pow (+ x 1.0) -0.5) (/ (+ 0.5 (/ (- -0.125 (/ -0.0625 x)) x)) x)))
double code(double x) {
return pow((x + 1.0), -0.5) * ((0.5 + ((-0.125 - (-0.0625 / x)) / x)) / x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((x + 1.0d0) ** (-0.5d0)) * ((0.5d0 + (((-0.125d0) - ((-0.0625d0) / x)) / x)) / x)
end function
public static double code(double x) {
return Math.pow((x + 1.0), -0.5) * ((0.5 + ((-0.125 - (-0.0625 / x)) / x)) / x);
}
def code(x): return math.pow((x + 1.0), -0.5) * ((0.5 + ((-0.125 - (-0.0625 / x)) / x)) / x)
function code(x) return Float64((Float64(x + 1.0) ^ -0.5) * Float64(Float64(0.5 + Float64(Float64(-0.125 - Float64(-0.0625 / x)) / x)) / x)) end
function tmp = code(x) tmp = ((x + 1.0) ^ -0.5) * ((0.5 + ((-0.125 - (-0.0625 / x)) / x)) / x); end
code[x_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision] * N[(N[(0.5 + N[(N[(-0.125 - N[(-0.0625 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{-0.5} \cdot \frac{0.5 + \frac{-0.125 - \frac{-0.0625}{x}}{x}}{x}
\end{array}
Initial program 38.3%
clear-numN/A
frac-subN/A
/-rgt-identityN/A
*-lft-identityN/A
metadata-evalN/A
div-invN/A
flip--N/A
*-rgt-identityN/A
metadata-evalN/A
div-invN/A
/-rgt-identityN/A
associate-/l/N/A
Applied egg-rr40.2%
associate--l+N/A
+-inversesN/A
metadata-evalN/A
inv-powN/A
*-commutativeN/A
sqrt-prodN/A
associate-*r*N/A
unpow-prod-downN/A
metadata-evalN/A
pow-powN/A
pow2N/A
rem-square-sqrtN/A
*-lowering-*.f64N/A
Applied egg-rr99.3%
Taylor expanded in x around inf
/-lowering-/.f64N/A
+-commutativeN/A
associate--l+N/A
metadata-evalN/A
associate-*r/N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
associate-*r/N/A
metadata-evalN/A
+-lowering-+.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6498.8%
Simplified98.8%
Taylor expanded in x around inf
Simplified98.8%
Final simplification98.8%
(FPCore (x) :precision binary64 (/ (pow (+ x 1.0) -0.5) (/ x (+ 0.5 (/ -0.125 x)))))
double code(double x) {
return pow((x + 1.0), -0.5) / (x / (0.5 + (-0.125 / x)));
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((x + 1.0d0) ** (-0.5d0)) / (x / (0.5d0 + ((-0.125d0) / x)))
end function
public static double code(double x) {
return Math.pow((x + 1.0), -0.5) / (x / (0.5 + (-0.125 / x)));
}
def code(x): return math.pow((x + 1.0), -0.5) / (x / (0.5 + (-0.125 / x)))
function code(x) return Float64((Float64(x + 1.0) ^ -0.5) / Float64(x / Float64(0.5 + Float64(-0.125 / x)))) end
function tmp = code(x) tmp = ((x + 1.0) ^ -0.5) / (x / (0.5 + (-0.125 / x))); end
code[x_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision] / N[(x / N[(0.5 + N[(-0.125 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(x + 1\right)}^{-0.5}}{\frac{x}{0.5 + \frac{-0.125}{x}}}
\end{array}
Initial program 38.3%
clear-numN/A
frac-subN/A
/-rgt-identityN/A
*-lft-identityN/A
metadata-evalN/A
div-invN/A
flip--N/A
*-rgt-identityN/A
metadata-evalN/A
div-invN/A
/-rgt-identityN/A
associate-/l/N/A
Applied egg-rr40.2%
associate--l+N/A
+-inversesN/A
metadata-evalN/A
inv-powN/A
*-commutativeN/A
sqrt-prodN/A
associate-*r*N/A
unpow-prod-downN/A
metadata-evalN/A
pow-powN/A
pow2N/A
rem-square-sqrtN/A
*-lowering-*.f64N/A
Applied egg-rr99.3%
Taylor expanded in x around inf
/-lowering-/.f64N/A
sub-negN/A
associate-*r/N/A
metadata-evalN/A
+-lowering-+.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6498.5%
Simplified98.5%
*-commutativeN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
pow-lowering-pow.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f6498.6%
Applied egg-rr98.6%
(FPCore (x) :precision binary64 (* (pow (+ x 1.0) -0.5) (/ (+ 0.5 (/ -0.125 x)) x)))
double code(double x) {
return pow((x + 1.0), -0.5) * ((0.5 + (-0.125 / x)) / x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((x + 1.0d0) ** (-0.5d0)) * ((0.5d0 + ((-0.125d0) / x)) / x)
end function
public static double code(double x) {
return Math.pow((x + 1.0), -0.5) * ((0.5 + (-0.125 / x)) / x);
}
def code(x): return math.pow((x + 1.0), -0.5) * ((0.5 + (-0.125 / x)) / x)
function code(x) return Float64((Float64(x + 1.0) ^ -0.5) * Float64(Float64(0.5 + Float64(-0.125 / x)) / x)) end
function tmp = code(x) tmp = ((x + 1.0) ^ -0.5) * ((0.5 + (-0.125 / x)) / x); end
code[x_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision] * N[(N[(0.5 + N[(-0.125 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{-0.5} \cdot \frac{0.5 + \frac{-0.125}{x}}{x}
\end{array}
Initial program 38.3%
clear-numN/A
frac-subN/A
/-rgt-identityN/A
*-lft-identityN/A
metadata-evalN/A
div-invN/A
flip--N/A
*-rgt-identityN/A
metadata-evalN/A
div-invN/A
/-rgt-identityN/A
associate-/l/N/A
Applied egg-rr40.2%
associate--l+N/A
+-inversesN/A
metadata-evalN/A
inv-powN/A
*-commutativeN/A
sqrt-prodN/A
associate-*r*N/A
unpow-prod-downN/A
metadata-evalN/A
pow-powN/A
pow2N/A
rem-square-sqrtN/A
*-lowering-*.f64N/A
Applied egg-rr99.3%
Taylor expanded in x around inf
/-lowering-/.f64N/A
sub-negN/A
associate-*r/N/A
metadata-evalN/A
+-lowering-+.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6498.5%
Simplified98.5%
Final simplification98.5%
(FPCore (x) :precision binary64 (* 0.5 (pow x -1.5)))
double code(double x) {
return 0.5 * pow(x, -1.5);
}
real(8) function code(x)
real(8), intent (in) :: x
code = 0.5d0 * (x ** (-1.5d0))
end function
public static double code(double x) {
return 0.5 * Math.pow(x, -1.5);
}
def code(x): return 0.5 * math.pow(x, -1.5)
function code(x) return Float64(0.5 * (x ^ -1.5)) end
function tmp = code(x) tmp = 0.5 * (x ^ -1.5); end
code[x_] := N[(0.5 * N[Power[x, -1.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot {x}^{-1.5}
\end{array}
Initial program 38.3%
Taylor expanded in x around inf
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6466.3%
Simplified66.3%
*-commutativeN/A
inv-powN/A
sqrt-pow1N/A
metadata-evalN/A
unpow-prod-downN/A
pow-prod-downN/A
cube-multN/A
*-lowering-*.f64N/A
pow-powN/A
pow-lowering-pow.f64N/A
metadata-eval97.6%
Applied egg-rr97.6%
Final simplification97.6%
(FPCore (x) :precision binary64 (if (<= x 6.4e+153) (/ (+ (/ -0.125 x) 0.5625) x) (/ -0.125 (* x x))))
double code(double x) {
double tmp;
if (x <= 6.4e+153) {
tmp = ((-0.125 / x) + 0.5625) / x;
} else {
tmp = -0.125 / (x * x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 6.4d+153) then
tmp = (((-0.125d0) / x) + 0.5625d0) / x
else
tmp = (-0.125d0) / (x * x)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 6.4e+153) {
tmp = ((-0.125 / x) + 0.5625) / x;
} else {
tmp = -0.125 / (x * x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 6.4e+153: tmp = ((-0.125 / x) + 0.5625) / x else: tmp = -0.125 / (x * x) return tmp
function code(x) tmp = 0.0 if (x <= 6.4e+153) tmp = Float64(Float64(Float64(-0.125 / x) + 0.5625) / x); else tmp = Float64(-0.125 / Float64(x * x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 6.4e+153) tmp = ((-0.125 / x) + 0.5625) / x; else tmp = -0.125 / (x * x); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 6.4e+153], N[(N[(N[(-0.125 / x), $MachinePrecision] + 0.5625), $MachinePrecision] / x), $MachinePrecision], N[(-0.125 / N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.4 \cdot 10^{+153}:\\
\;\;\;\;\frac{\frac{-0.125}{x} + 0.5625}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.125}{x \cdot x}\\
\end{array}
\end{array}
if x < 6.4000000000000003e153Initial program 10.8%
clear-numN/A
frac-subN/A
/-rgt-identityN/A
*-lft-identityN/A
metadata-evalN/A
div-invN/A
flip--N/A
*-rgt-identityN/A
metadata-evalN/A
div-invN/A
/-rgt-identityN/A
associate-/l/N/A
Applied egg-rr14.7%
associate--l+N/A
+-inversesN/A
metadata-evalN/A
inv-powN/A
*-commutativeN/A
sqrt-prodN/A
associate-*r*N/A
unpow-prod-downN/A
metadata-evalN/A
pow-powN/A
pow2N/A
rem-square-sqrtN/A
*-lowering-*.f64N/A
Applied egg-rr99.0%
Taylor expanded in x around inf
/-lowering-/.f64N/A
sub-negN/A
associate-*r/N/A
metadata-evalN/A
+-lowering-+.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6497.4%
Simplified97.4%
Taylor expanded in x around 0
unpow2N/A
associate-/r*N/A
/-lowering-/.f64N/A
div-subN/A
associate-/l*N/A
*-rgt-identityN/A
associate-*r/N/A
rgt-mult-inverseN/A
metadata-evalN/A
metadata-evalN/A
associate-*r/N/A
sub-negN/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f648.6%
Simplified8.6%
if 6.4000000000000003e153 < x Initial program 66.2%
clear-numN/A
frac-subN/A
/-rgt-identityN/A
*-lft-identityN/A
metadata-evalN/A
div-invN/A
flip--N/A
*-rgt-identityN/A
metadata-evalN/A
div-invN/A
/-rgt-identityN/A
associate-/l/N/A
Applied egg-rr66.2%
associate--l+N/A
+-inversesN/A
metadata-evalN/A
inv-powN/A
*-commutativeN/A
sqrt-prodN/A
associate-*r*N/A
unpow-prod-downN/A
metadata-evalN/A
pow-powN/A
pow2N/A
rem-square-sqrtN/A
*-lowering-*.f64N/A
Applied egg-rr99.6%
Taylor expanded in x around inf
/-lowering-/.f64N/A
sub-negN/A
associate-*r/N/A
metadata-evalN/A
+-lowering-+.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6499.8%
Simplified99.8%
Taylor expanded in x around 0
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6466.2%
Simplified66.2%
Final simplification37.2%
(FPCore (x) :precision binary64 (/ -0.125 (* x x)))
double code(double x) {
return -0.125 / (x * x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = (-0.125d0) / (x * x)
end function
public static double code(double x) {
return -0.125 / (x * x);
}
def code(x): return -0.125 / (x * x)
function code(x) return Float64(-0.125 / Float64(x * x)) end
function tmp = code(x) tmp = -0.125 / (x * x); end
code[x_] := N[(-0.125 / N[(x * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-0.125}{x \cdot x}
\end{array}
Initial program 38.3%
clear-numN/A
frac-subN/A
/-rgt-identityN/A
*-lft-identityN/A
metadata-evalN/A
div-invN/A
flip--N/A
*-rgt-identityN/A
metadata-evalN/A
div-invN/A
/-rgt-identityN/A
associate-/l/N/A
Applied egg-rr40.2%
associate--l+N/A
+-inversesN/A
metadata-evalN/A
inv-powN/A
*-commutativeN/A
sqrt-prodN/A
associate-*r*N/A
unpow-prod-downN/A
metadata-evalN/A
pow-powN/A
pow2N/A
rem-square-sqrtN/A
*-lowering-*.f64N/A
Applied egg-rr99.3%
Taylor expanded in x around inf
/-lowering-/.f64N/A
sub-negN/A
associate-*r/N/A
metadata-evalN/A
+-lowering-+.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6498.5%
Simplified98.5%
Taylor expanded in x around 0
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6434.4%
Simplified34.4%
(FPCore (x) :precision binary64 (/ 1.0 (+ (* (+ x 1.0) (sqrt x)) (* x (sqrt (+ x 1.0))))))
double code(double x) {
return 1.0 / (((x + 1.0) * sqrt(x)) + (x * sqrt((x + 1.0))));
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0 / (((x + 1.0d0) * sqrt(x)) + (x * sqrt((x + 1.0d0))))
end function
public static double code(double x) {
return 1.0 / (((x + 1.0) * Math.sqrt(x)) + (x * Math.sqrt((x + 1.0))));
}
def code(x): return 1.0 / (((x + 1.0) * math.sqrt(x)) + (x * math.sqrt((x + 1.0))))
function code(x) return Float64(1.0 / Float64(Float64(Float64(x + 1.0) * sqrt(x)) + Float64(x * sqrt(Float64(x + 1.0))))) end
function tmp = code(x) tmp = 1.0 / (((x + 1.0) * sqrt(x)) + (x * sqrt((x + 1.0)))); end
code[x_] := N[(1.0 / N[(N[(N[(x + 1.0), $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(x * N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\left(x + 1\right) \cdot \sqrt{x} + x \cdot \sqrt{x + 1}}
\end{array}
herbie shell --seed 2024147
(FPCore (x)
:name "2isqrt (example 3.6)"
:precision binary64
:pre (and (> x 1.0) (< x 1e+308))
:alt
(! :herbie-platform default (/ 1 (+ (* (+ x 1) (sqrt x)) (* x (sqrt (+ x 1))))))
(- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))