
(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 10 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 (let* ((t_0 (sqrt (+ x 1.0)))) (/ (/ 1.0 (+ x (* t_0 (sqrt x)))) t_0)))
double code(double x) {
double t_0 = sqrt((x + 1.0));
return (1.0 / (x + (t_0 * sqrt(x)))) / t_0;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
t_0 = sqrt((x + 1.0d0))
code = (1.0d0 / (x + (t_0 * sqrt(x)))) / t_0
end function
public static double code(double x) {
double t_0 = Math.sqrt((x + 1.0));
return (1.0 / (x + (t_0 * Math.sqrt(x)))) / t_0;
}
def code(x): t_0 = math.sqrt((x + 1.0)) return (1.0 / (x + (t_0 * math.sqrt(x)))) / t_0
function code(x) t_0 = sqrt(Float64(x + 1.0)) return Float64(Float64(1.0 / Float64(x + Float64(t_0 * sqrt(x)))) / t_0) end
function tmp = code(x) t_0 = sqrt((x + 1.0)); tmp = (1.0 / (x + (t_0 * sqrt(x)))) / t_0; end
code[x_] := Block[{t$95$0 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, N[(N[(1.0 / N[(x + N[(t$95$0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{x + 1}\\
\frac{\frac{1}{x + t\_0 \cdot \sqrt{x}}}{t\_0}
\end{array}
\end{array}
Initial program 40.4%
frac-sub40.5%
clear-num40.5%
sqrt-unprod40.5%
+-commutative40.5%
*-un-lft-identity40.5%
+-commutative40.5%
*-rgt-identity40.5%
Applied egg-rr40.5%
associate-/r/40.5%
Simplified40.5%
flip--41.7%
add-sqr-sqrt42.4%
add-sqr-sqrt44.1%
add-sqr-sqrt44.1%
hypot-1-def44.1%
Applied egg-rr44.1%
associate--l+85.2%
+-inverses85.2%
metadata-eval85.2%
+-commutative85.2%
hypot-undefine85.2%
metadata-eval85.2%
rem-square-sqrt85.2%
Simplified85.2%
associate-*l/85.3%
*-un-lft-identity85.3%
sqrt-prod99.3%
associate-/r*99.2%
Applied egg-rr99.2%
associate-/l/99.2%
distribute-rgt-in99.2%
rem-square-sqrt99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (x) :precision binary64 (/ (/ -1.0 (- (* x (- -1.0 (/ (+ 0.5 (/ -0.125 x)) x))) x)) (sqrt (+ x 1.0))))
double code(double x) {
return (-1.0 / ((x * (-1.0 - ((0.5 + (-0.125 / x)) / x))) - x)) / sqrt((x + 1.0));
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((-1.0d0) / ((x * ((-1.0d0) - ((0.5d0 + ((-0.125d0) / x)) / x))) - x)) / sqrt((x + 1.0d0))
end function
public static double code(double x) {
return (-1.0 / ((x * (-1.0 - ((0.5 + (-0.125 / x)) / x))) - x)) / Math.sqrt((x + 1.0));
}
def code(x): return (-1.0 / ((x * (-1.0 - ((0.5 + (-0.125 / x)) / x))) - x)) / math.sqrt((x + 1.0))
function code(x) return Float64(Float64(-1.0 / Float64(Float64(x * Float64(-1.0 - Float64(Float64(0.5 + Float64(-0.125 / x)) / x))) - x)) / sqrt(Float64(x + 1.0))) end
function tmp = code(x) tmp = (-1.0 / ((x * (-1.0 - ((0.5 + (-0.125 / x)) / x))) - x)) / sqrt((x + 1.0)); end
code[x_] := N[(N[(-1.0 / N[(N[(x * N[(-1.0 - N[(N[(0.5 + N[(-0.125 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{-1}{x \cdot \left(-1 - \frac{0.5 + \frac{-0.125}{x}}{x}\right) - x}}{\sqrt{x + 1}}
\end{array}
Initial program 40.4%
frac-sub40.5%
clear-num40.5%
sqrt-unprod40.5%
+-commutative40.5%
*-un-lft-identity40.5%
+-commutative40.5%
*-rgt-identity40.5%
Applied egg-rr40.5%
associate-/r/40.5%
Simplified40.5%
flip--41.7%
add-sqr-sqrt42.4%
add-sqr-sqrt44.1%
add-sqr-sqrt44.1%
hypot-1-def44.1%
Applied egg-rr44.1%
associate--l+85.2%
+-inverses85.2%
metadata-eval85.2%
+-commutative85.2%
hypot-undefine85.2%
metadata-eval85.2%
rem-square-sqrt85.2%
Simplified85.2%
associate-*l/85.3%
*-un-lft-identity85.3%
sqrt-prod99.3%
associate-/r*99.2%
Applied egg-rr99.2%
associate-/l/99.2%
distribute-rgt-in99.2%
rem-square-sqrt99.4%
Simplified99.4%
Taylor expanded in x around -inf 0.0%
mul-1-neg0.0%
distribute-rgt-neg-in0.0%
+-commutative0.0%
unpow20.0%
rem-square-sqrt0.0%
mul-1-neg0.0%
unsub-neg0.0%
Simplified98.8%
Final simplification98.8%
(FPCore (x) :precision binary64 (/ (/ (- (/ (+ -0.125 (/ 0.0625 x)) x) -0.5) x) (sqrt (+ x 1.0))))
double code(double x) {
return ((((-0.125 + (0.0625 / x)) / x) - -0.5) / x) / sqrt((x + 1.0));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (((((-0.125d0) + (0.0625d0 / x)) / x) - (-0.5d0)) / x) / sqrt((x + 1.0d0))
end function
public static double code(double x) {
return ((((-0.125 + (0.0625 / x)) / x) - -0.5) / x) / Math.sqrt((x + 1.0));
}
def code(x): return ((((-0.125 + (0.0625 / x)) / x) - -0.5) / x) / math.sqrt((x + 1.0))
function code(x) return Float64(Float64(Float64(Float64(Float64(-0.125 + Float64(0.0625 / x)) / x) - -0.5) / x) / sqrt(Float64(x + 1.0))) end
function tmp = code(x) tmp = ((((-0.125 + (0.0625 / x)) / x) - -0.5) / x) / sqrt((x + 1.0)); end
code[x_] := N[(N[(N[(N[(N[(-0.125 + N[(0.0625 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - -0.5), $MachinePrecision] / x), $MachinePrecision] / N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\frac{-0.125 + \frac{0.0625}{x}}{x} - -0.5}{x}}{\sqrt{x + 1}}
\end{array}
Initial program 40.4%
frac-sub40.5%
clear-num40.5%
sqrt-unprod40.5%
+-commutative40.5%
*-un-lft-identity40.5%
+-commutative40.5%
*-rgt-identity40.5%
Applied egg-rr40.5%
associate-/r/40.5%
Simplified40.5%
flip--41.7%
add-sqr-sqrt42.4%
add-sqr-sqrt44.1%
add-sqr-sqrt44.1%
hypot-1-def44.1%
Applied egg-rr44.1%
associate--l+85.2%
+-inverses85.2%
metadata-eval85.2%
+-commutative85.2%
hypot-undefine85.2%
metadata-eval85.2%
rem-square-sqrt85.2%
Simplified85.2%
associate-*l/85.3%
*-un-lft-identity85.3%
sqrt-prod99.3%
associate-/r*99.2%
Applied egg-rr99.2%
associate-/l/99.2%
distribute-rgt-in99.2%
rem-square-sqrt99.4%
Simplified99.4%
Taylor expanded in x around -inf 0.0%
Simplified98.8%
Final simplification98.8%
(FPCore (x) :precision binary64 (/ (/ -1.0 (- (* x (- -1.0 (/ 0.5 x))) x)) (sqrt (+ x 1.0))))
double code(double x) {
return (-1.0 / ((x * (-1.0 - (0.5 / x))) - x)) / sqrt((x + 1.0));
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((-1.0d0) / ((x * ((-1.0d0) - (0.5d0 / x))) - x)) / sqrt((x + 1.0d0))
end function
public static double code(double x) {
return (-1.0 / ((x * (-1.0 - (0.5 / x))) - x)) / Math.sqrt((x + 1.0));
}
def code(x): return (-1.0 / ((x * (-1.0 - (0.5 / x))) - x)) / math.sqrt((x + 1.0))
function code(x) return Float64(Float64(-1.0 / Float64(Float64(x * Float64(-1.0 - Float64(0.5 / x))) - x)) / sqrt(Float64(x + 1.0))) end
function tmp = code(x) tmp = (-1.0 / ((x * (-1.0 - (0.5 / x))) - x)) / sqrt((x + 1.0)); end
code[x_] := N[(N[(-1.0 / N[(N[(x * N[(-1.0 - N[(0.5 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{-1}{x \cdot \left(-1 - \frac{0.5}{x}\right) - x}}{\sqrt{x + 1}}
\end{array}
Initial program 40.4%
frac-sub40.5%
clear-num40.5%
sqrt-unprod40.5%
+-commutative40.5%
*-un-lft-identity40.5%
+-commutative40.5%
*-rgt-identity40.5%
Applied egg-rr40.5%
associate-/r/40.5%
Simplified40.5%
flip--41.7%
add-sqr-sqrt42.4%
add-sqr-sqrt44.1%
add-sqr-sqrt44.1%
hypot-1-def44.1%
Applied egg-rr44.1%
associate--l+85.2%
+-inverses85.2%
metadata-eval85.2%
+-commutative85.2%
hypot-undefine85.2%
metadata-eval85.2%
rem-square-sqrt85.2%
Simplified85.2%
associate-*l/85.3%
*-un-lft-identity85.3%
sqrt-prod99.3%
associate-/r*99.2%
Applied egg-rr99.2%
associate-/l/99.2%
distribute-rgt-in99.2%
rem-square-sqrt99.4%
Simplified99.4%
Taylor expanded in x around inf 98.3%
associate-*r/98.3%
metadata-eval98.3%
Simplified98.3%
Final simplification98.3%
(FPCore (x) :precision binary64 (/ (/ 1.0 (* x (+ (/ 0.5 x) 2.0))) (sqrt (+ x 1.0))))
double code(double x) {
return (1.0 / (x * ((0.5 / x) + 2.0))) / sqrt((x + 1.0));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 / (x * ((0.5d0 / x) + 2.0d0))) / sqrt((x + 1.0d0))
end function
public static double code(double x) {
return (1.0 / (x * ((0.5 / x) + 2.0))) / Math.sqrt((x + 1.0));
}
def code(x): return (1.0 / (x * ((0.5 / x) + 2.0))) / math.sqrt((x + 1.0))
function code(x) return Float64(Float64(1.0 / Float64(x * Float64(Float64(0.5 / x) + 2.0))) / sqrt(Float64(x + 1.0))) end
function tmp = code(x) tmp = (1.0 / (x * ((0.5 / x) + 2.0))) / sqrt((x + 1.0)); end
code[x_] := N[(N[(1.0 / N[(x * N[(N[(0.5 / x), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x \cdot \left(\frac{0.5}{x} + 2\right)}}{\sqrt{x + 1}}
\end{array}
Initial program 40.4%
frac-sub40.5%
clear-num40.5%
sqrt-unprod40.5%
+-commutative40.5%
*-un-lft-identity40.5%
+-commutative40.5%
*-rgt-identity40.5%
Applied egg-rr40.5%
associate-/r/40.5%
Simplified40.5%
flip--41.7%
add-sqr-sqrt42.4%
add-sqr-sqrt44.1%
add-sqr-sqrt44.1%
hypot-1-def44.1%
Applied egg-rr44.1%
associate--l+85.2%
+-inverses85.2%
metadata-eval85.2%
+-commutative85.2%
hypot-undefine85.2%
metadata-eval85.2%
rem-square-sqrt85.2%
Simplified85.2%
associate-*l/85.3%
*-un-lft-identity85.3%
sqrt-prod99.3%
associate-/r*99.2%
Applied egg-rr99.2%
associate-/l/99.2%
distribute-rgt-in99.2%
rem-square-sqrt99.4%
Simplified99.4%
Taylor expanded in x around inf 98.2%
associate-*r/98.2%
metadata-eval98.2%
Simplified98.2%
Final simplification98.2%
(FPCore (x) :precision binary64 (/ (/ (- 0.5 (/ 0.125 x)) x) (sqrt (+ x 1.0))))
double code(double x) {
return ((0.5 - (0.125 / x)) / x) / sqrt((x + 1.0));
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((0.5d0 - (0.125d0 / x)) / x) / sqrt((x + 1.0d0))
end function
public static double code(double x) {
return ((0.5 - (0.125 / x)) / x) / Math.sqrt((x + 1.0));
}
def code(x): return ((0.5 - (0.125 / x)) / x) / math.sqrt((x + 1.0))
function code(x) return Float64(Float64(Float64(0.5 - Float64(0.125 / x)) / x) / sqrt(Float64(x + 1.0))) end
function tmp = code(x) tmp = ((0.5 - (0.125 / x)) / x) / sqrt((x + 1.0)); end
code[x_] := N[(N[(N[(0.5 - N[(0.125 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{0.5 - \frac{0.125}{x}}{x}}{\sqrt{x + 1}}
\end{array}
Initial program 40.4%
frac-sub40.5%
clear-num40.5%
sqrt-unprod40.5%
+-commutative40.5%
*-un-lft-identity40.5%
+-commutative40.5%
*-rgt-identity40.5%
Applied egg-rr40.5%
associate-/r/40.5%
Simplified40.5%
flip--41.7%
add-sqr-sqrt42.4%
add-sqr-sqrt44.1%
add-sqr-sqrt44.1%
hypot-1-def44.1%
Applied egg-rr44.1%
associate--l+85.2%
+-inverses85.2%
metadata-eval85.2%
+-commutative85.2%
hypot-undefine85.2%
metadata-eval85.2%
rem-square-sqrt85.2%
Simplified85.2%
associate-*l/85.3%
*-un-lft-identity85.3%
sqrt-prod99.3%
associate-/r*99.2%
Applied egg-rr99.2%
associate-/l/99.2%
distribute-rgt-in99.2%
rem-square-sqrt99.4%
Simplified99.4%
Taylor expanded in x around inf 98.2%
associate-*r/98.2%
metadata-eval98.2%
Simplified98.2%
Final simplification98.2%
(FPCore (x) :precision binary64 (/ (/ (- 0.5 (/ 0.375 x)) x) (sqrt x)))
double code(double x) {
return ((0.5 - (0.375 / x)) / x) / sqrt(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((0.5d0 - (0.375d0 / x)) / x) / sqrt(x)
end function
public static double code(double x) {
return ((0.5 - (0.375 / x)) / x) / Math.sqrt(x);
}
def code(x): return ((0.5 - (0.375 / x)) / x) / math.sqrt(x)
function code(x) return Float64(Float64(Float64(0.5 - Float64(0.375 / x)) / x) / sqrt(x)) end
function tmp = code(x) tmp = ((0.5 - (0.375 / x)) / x) / sqrt(x); end
code[x_] := N[(N[(N[(0.5 - N[(0.375 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{0.5 - \frac{0.375}{x}}{x}}{\sqrt{x}}
\end{array}
Initial program 40.4%
frac-sub40.5%
*-un-lft-identity40.5%
+-commutative40.5%
*-rgt-identity40.5%
sqrt-unprod40.5%
+-commutative40.5%
Applied egg-rr40.5%
add-cube-cbrt40.5%
sqrt-prod40.5%
times-frac40.5%
pow240.5%
Applied egg-rr40.5%
associate-*l/40.5%
associate-*r/40.5%
unpow240.5%
rem-3cbrt-lft40.5%
div-sub40.5%
*-inverses40.5%
Simplified40.5%
Taylor expanded in x around inf 98.0%
associate-*r/98.0%
metadata-eval98.0%
Simplified98.0%
(FPCore (x) :precision binary64 (if (<= x 8.5e+122) (pow x -0.5) 0.0))
double code(double x) {
double tmp;
if (x <= 8.5e+122) {
tmp = pow(x, -0.5);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 8.5d+122) then
tmp = x ** (-0.5d0)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 8.5e+122) {
tmp = Math.pow(x, -0.5);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x): tmp = 0 if x <= 8.5e+122: tmp = math.pow(x, -0.5) else: tmp = 0.0 return tmp
function code(x) tmp = 0.0 if (x <= 8.5e+122) tmp = x ^ -0.5; else tmp = 0.0; end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 8.5e+122) tmp = x ^ -0.5; else tmp = 0.0; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 8.5e+122], N[Power[x, -0.5], $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 8.5 \cdot 10^{+122}:\\
\;\;\;\;{x}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 8.50000000000000003e122Initial program 17.4%
Taylor expanded in x around 0 7.8%
inv-pow7.8%
sqrt-pow17.8%
metadata-eval7.8%
*-un-lft-identity7.8%
Applied egg-rr7.8%
*-lft-identity7.8%
Simplified7.8%
if 8.50000000000000003e122 < x Initial program 56.9%
inv-pow56.9%
add-cube-cbrt21.6%
unpow-prod-down15.3%
fma-neg4.3%
cbrt-prod4.2%
add-sqr-sqrt4.3%
distribute-neg-frac4.3%
metadata-eval4.3%
+-commutative4.3%
Applied egg-rr4.3%
Taylor expanded in x around inf 56.9%
distribute-rgt1-in56.9%
metadata-eval56.9%
mul0-lft56.9%
Simplified56.9%
(FPCore (x) :precision binary64 (/ (/ 0.5 x) (sqrt (+ x 1.0))))
double code(double x) {
return (0.5 / x) / sqrt((x + 1.0));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (0.5d0 / x) / sqrt((x + 1.0d0))
end function
public static double code(double x) {
return (0.5 / x) / Math.sqrt((x + 1.0));
}
def code(x): return (0.5 / x) / math.sqrt((x + 1.0))
function code(x) return Float64(Float64(0.5 / x) / sqrt(Float64(x + 1.0))) end
function tmp = code(x) tmp = (0.5 / x) / sqrt((x + 1.0)); end
code[x_] := N[(N[(0.5 / x), $MachinePrecision] / N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{0.5}{x}}{\sqrt{x + 1}}
\end{array}
Initial program 40.4%
frac-sub40.5%
clear-num40.5%
sqrt-unprod40.5%
+-commutative40.5%
*-un-lft-identity40.5%
+-commutative40.5%
*-rgt-identity40.5%
Applied egg-rr40.5%
associate-/r/40.5%
Simplified40.5%
flip--41.7%
add-sqr-sqrt42.4%
add-sqr-sqrt44.1%
add-sqr-sqrt44.1%
hypot-1-def44.1%
Applied egg-rr44.1%
associate--l+85.2%
+-inverses85.2%
metadata-eval85.2%
+-commutative85.2%
hypot-undefine85.2%
metadata-eval85.2%
rem-square-sqrt85.2%
Simplified85.2%
associate-*l/85.3%
*-un-lft-identity85.3%
sqrt-prod99.3%
associate-/r*99.2%
Applied egg-rr99.2%
associate-/l/99.2%
distribute-rgt-in99.2%
rem-square-sqrt99.4%
Simplified99.4%
Taylor expanded in x around inf 95.9%
Final simplification95.9%
(FPCore (x) :precision binary64 0.0)
double code(double x) {
return 0.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = 0.0d0
end function
public static double code(double x) {
return 0.0;
}
def code(x): return 0.0
function code(x) return 0.0 end
function tmp = code(x) tmp = 0.0; end
code[x_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 40.4%
inv-pow40.4%
add-cube-cbrt19.4%
unpow-prod-down15.8%
fma-neg9.4%
cbrt-prod9.6%
add-sqr-sqrt9.4%
distribute-neg-frac9.4%
metadata-eval9.4%
+-commutative9.4%
Applied egg-rr9.4%
Taylor expanded in x around inf 34.8%
distribute-rgt1-in34.8%
metadata-eval34.8%
mul0-lft34.8%
Simplified34.8%
(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 2024106
(FPCore (x)
:name "2isqrt (example 3.6)"
:precision binary64
:pre (and (> x 1.0) (< x 1e+308))
:alt
(/ 1.0 (+ (* (+ x 1.0) (sqrt x)) (* x (sqrt (+ x 1.0)))))
(- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))