
(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 13 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 x -0.5) (+ (pow x -0.5) (pow (+ x 1.0) -0.5))) (/ (pow x -0.5) (+ x 1.0))))
double code(double x) {
return (pow(x, -0.5) / (pow(x, -0.5) + pow((x + 1.0), -0.5))) * (pow(x, -0.5) / (x + 1.0));
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((x ** (-0.5d0)) / ((x ** (-0.5d0)) + ((x + 1.0d0) ** (-0.5d0)))) * ((x ** (-0.5d0)) / (x + 1.0d0))
end function
public static double code(double x) {
return (Math.pow(x, -0.5) / (Math.pow(x, -0.5) + Math.pow((x + 1.0), -0.5))) * (Math.pow(x, -0.5) / (x + 1.0));
}
def code(x): return (math.pow(x, -0.5) / (math.pow(x, -0.5) + math.pow((x + 1.0), -0.5))) * (math.pow(x, -0.5) / (x + 1.0))
function code(x) return Float64(Float64((x ^ -0.5) / Float64((x ^ -0.5) + (Float64(x + 1.0) ^ -0.5))) * Float64((x ^ -0.5) / Float64(x + 1.0))) end
function tmp = code(x) tmp = ((x ^ -0.5) / ((x ^ -0.5) + ((x + 1.0) ^ -0.5))) * ((x ^ -0.5) / (x + 1.0)); end
code[x_] := N[(N[(N[Power[x, -0.5], $MachinePrecision] / N[(N[Power[x, -0.5], $MachinePrecision] + N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[x, -0.5], $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{x}^{-0.5}}{{x}^{-0.5} + {\left(x + 1\right)}^{-0.5}} \cdot \frac{{x}^{-0.5}}{x + 1}
\end{array}
Initial program 67.9%
*-un-lft-identity67.9%
clear-num67.9%
associate-/r/67.9%
prod-diff67.9%
*-un-lft-identity67.9%
fma-neg67.9%
*-un-lft-identity67.9%
pow1/267.9%
pow-flip63.8%
metadata-eval63.8%
pow1/263.8%
pow-flip68.0%
+-commutative68.0%
metadata-eval68.0%
Applied egg-rr68.0%
+-commutative68.0%
sub-neg68.0%
fma-udef68.0%
distribute-lft1-in68.0%
metadata-eval68.0%
mul0-lft68.0%
+-commutative68.0%
associate-+r+68.0%
sub-neg68.0%
neg-sub068.0%
+-commutative68.0%
sub-neg68.0%
Simplified68.0%
metadata-eval68.0%
pow-flip63.8%
+-commutative63.8%
pow1/263.8%
flip--63.7%
pow-prod-up58.2%
metadata-eval58.2%
inv-pow58.2%
+-commutative58.2%
+-commutative58.2%
frac-times62.3%
metadata-eval62.3%
add-sqr-sqrt67.8%
+-commutative67.8%
pow1/267.8%
Applied egg-rr67.8%
frac-sub68.6%
*-un-lft-identity68.6%
+-commutative68.6%
+-commutative68.6%
Applied egg-rr68.6%
*-rgt-identity68.6%
associate--l+88.6%
+-inverses88.6%
metadata-eval88.6%
associate-/r*89.4%
Simplified89.4%
associate-/l/99.4%
inv-pow99.4%
metadata-eval99.4%
pow-prod-up99.7%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x) :precision binary64 (if (<= (+ (/ 1.0 (sqrt x)) (/ -1.0 (sqrt (+ x 1.0)))) 4e-13) (/ (/ (/ 1.0 x) (+ x 1.0)) (* 2.0 (sqrt (/ 1.0 x)))) (- (pow x -0.5) (pow (+ x 1.0) -0.5))))
double code(double x) {
double tmp;
if (((1.0 / sqrt(x)) + (-1.0 / sqrt((x + 1.0)))) <= 4e-13) {
tmp = ((1.0 / x) / (x + 1.0)) / (2.0 * sqrt((1.0 / x)));
} else {
tmp = pow(x, -0.5) - pow((x + 1.0), -0.5);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (((1.0d0 / sqrt(x)) + ((-1.0d0) / sqrt((x + 1.0d0)))) <= 4d-13) then
tmp = ((1.0d0 / x) / (x + 1.0d0)) / (2.0d0 * sqrt((1.0d0 / x)))
else
tmp = (x ** (-0.5d0)) - ((x + 1.0d0) ** (-0.5d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (((1.0 / Math.sqrt(x)) + (-1.0 / Math.sqrt((x + 1.0)))) <= 4e-13) {
tmp = ((1.0 / x) / (x + 1.0)) / (2.0 * Math.sqrt((1.0 / x)));
} else {
tmp = Math.pow(x, -0.5) - Math.pow((x + 1.0), -0.5);
}
return tmp;
}
def code(x): tmp = 0 if ((1.0 / math.sqrt(x)) + (-1.0 / math.sqrt((x + 1.0)))) <= 4e-13: tmp = ((1.0 / x) / (x + 1.0)) / (2.0 * math.sqrt((1.0 / x))) else: tmp = math.pow(x, -0.5) - math.pow((x + 1.0), -0.5) return tmp
function code(x) tmp = 0.0 if (Float64(Float64(1.0 / sqrt(x)) + Float64(-1.0 / sqrt(Float64(x + 1.0)))) <= 4e-13) tmp = Float64(Float64(Float64(1.0 / x) / Float64(x + 1.0)) / Float64(2.0 * sqrt(Float64(1.0 / x)))); else tmp = Float64((x ^ -0.5) - (Float64(x + 1.0) ^ -0.5)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (((1.0 / sqrt(x)) + (-1.0 / sqrt((x + 1.0)))) <= 4e-13) tmp = ((1.0 / x) / (x + 1.0)) / (2.0 * sqrt((1.0 / x))); else tmp = (x ^ -0.5) - ((x + 1.0) ^ -0.5); end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4e-13], N[(N[(N[(1.0 / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(2.0 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] - N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{\sqrt{x + 1}} \leq 4 \cdot 10^{-13}:\\
\;\;\;\;\frac{\frac{\frac{1}{x}}{x + 1}}{2 \cdot \sqrt{\frac{1}{x}}}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} - {\left(x + 1\right)}^{-0.5}\\
\end{array}
\end{array}
if (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) < 4.0000000000000001e-13Initial program 39.7%
*-un-lft-identity39.7%
clear-num39.7%
associate-/r/39.7%
prod-diff39.7%
*-un-lft-identity39.7%
fma-neg39.7%
*-un-lft-identity39.7%
pow1/239.7%
pow-flip31.7%
metadata-eval31.7%
pow1/231.7%
pow-flip39.7%
+-commutative39.7%
metadata-eval39.7%
Applied egg-rr39.7%
+-commutative39.7%
sub-neg39.7%
fma-udef39.7%
distribute-lft1-in39.7%
metadata-eval39.7%
mul0-lft39.7%
+-commutative39.7%
associate-+r+39.7%
sub-neg39.7%
neg-sub039.7%
+-commutative39.7%
sub-neg39.7%
Simplified39.7%
metadata-eval39.7%
pow-flip31.7%
+-commutative31.7%
pow1/231.7%
flip--31.7%
pow-prod-up21.7%
metadata-eval21.7%
inv-pow21.7%
+-commutative21.7%
+-commutative21.7%
frac-times29.5%
metadata-eval29.5%
add-sqr-sqrt39.8%
+-commutative39.8%
pow1/239.8%
Applied egg-rr39.8%
frac-sub41.0%
*-un-lft-identity41.0%
+-commutative41.0%
+-commutative41.0%
Applied egg-rr41.0%
*-rgt-identity41.0%
associate--l+79.0%
+-inverses79.0%
metadata-eval79.0%
associate-/r*80.6%
Simplified80.6%
Taylor expanded in x around inf 79.8%
if 4.0000000000000001e-13 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) Initial program 99.3%
*-un-lft-identity99.3%
clear-num99.3%
associate-/r/99.3%
prod-diff99.3%
*-un-lft-identity99.3%
fma-neg99.3%
*-un-lft-identity99.3%
pow1/299.3%
pow-flip99.6%
metadata-eval99.6%
pow1/299.6%
pow-flip99.6%
+-commutative99.6%
metadata-eval99.6%
Applied egg-rr99.6%
+-commutative99.6%
sub-neg99.6%
fma-udef99.6%
distribute-lft1-in99.6%
metadata-eval99.6%
mul0-lft99.6%
+-commutative99.6%
associate-+r+99.6%
sub-neg99.6%
neg-sub099.6%
+-commutative99.6%
sub-neg99.6%
Simplified99.6%
Final simplification89.1%
(FPCore (x) :precision binary64 (* (/ 1.0 x) (/ 1.0 (* (+ x 1.0) (+ (pow x -0.5) (pow (+ x 1.0) -0.5))))))
double code(double x) {
return (1.0 / x) * (1.0 / ((x + 1.0) * (pow(x, -0.5) + pow((x + 1.0), -0.5))));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 / x) * (1.0d0 / ((x + 1.0d0) * ((x ** (-0.5d0)) + ((x + 1.0d0) ** (-0.5d0)))))
end function
public static double code(double x) {
return (1.0 / x) * (1.0 / ((x + 1.0) * (Math.pow(x, -0.5) + Math.pow((x + 1.0), -0.5))));
}
def code(x): return (1.0 / x) * (1.0 / ((x + 1.0) * (math.pow(x, -0.5) + math.pow((x + 1.0), -0.5))))
function code(x) return Float64(Float64(1.0 / x) * Float64(1.0 / Float64(Float64(x + 1.0) * Float64((x ^ -0.5) + (Float64(x + 1.0) ^ -0.5))))) end
function tmp = code(x) tmp = (1.0 / x) * (1.0 / ((x + 1.0) * ((x ^ -0.5) + ((x + 1.0) ^ -0.5)))); end
code[x_] := N[(N[(1.0 / x), $MachinePrecision] * N[(1.0 / N[(N[(x + 1.0), $MachinePrecision] * N[(N[Power[x, -0.5], $MachinePrecision] + N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{x} \cdot \frac{1}{\left(x + 1\right) \cdot \left({x}^{-0.5} + {\left(x + 1\right)}^{-0.5}\right)}
\end{array}
Initial program 67.9%
*-un-lft-identity67.9%
clear-num67.9%
associate-/r/67.9%
prod-diff67.9%
*-un-lft-identity67.9%
fma-neg67.9%
*-un-lft-identity67.9%
pow1/267.9%
pow-flip63.8%
metadata-eval63.8%
pow1/263.8%
pow-flip68.0%
+-commutative68.0%
metadata-eval68.0%
Applied egg-rr68.0%
+-commutative68.0%
sub-neg68.0%
fma-udef68.0%
distribute-lft1-in68.0%
metadata-eval68.0%
mul0-lft68.0%
+-commutative68.0%
associate-+r+68.0%
sub-neg68.0%
neg-sub068.0%
+-commutative68.0%
sub-neg68.0%
Simplified68.0%
metadata-eval68.0%
pow-flip63.8%
+-commutative63.8%
pow1/263.8%
flip--63.7%
pow-prod-up58.2%
metadata-eval58.2%
inv-pow58.2%
+-commutative58.2%
+-commutative58.2%
frac-times62.3%
metadata-eval62.3%
add-sqr-sqrt67.8%
+-commutative67.8%
pow1/267.8%
Applied egg-rr67.8%
frac-sub68.6%
*-un-lft-identity68.6%
+-commutative68.6%
+-commutative68.6%
Applied egg-rr68.6%
*-rgt-identity68.6%
associate--l+88.6%
+-inverses88.6%
metadata-eval88.6%
associate-/r*89.4%
Simplified89.4%
associate-/l/99.4%
div-inv99.4%
+-commutative99.4%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (x) :precision binary64 (/ (/ 1.0 (* x (+ x 1.0))) (+ (pow x -0.5) (pow (+ x 1.0) -0.5))))
double code(double x) {
return (1.0 / (x * (x + 1.0))) / (pow(x, -0.5) + pow((x + 1.0), -0.5));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 / (x * (x + 1.0d0))) / ((x ** (-0.5d0)) + ((x + 1.0d0) ** (-0.5d0)))
end function
public static double code(double x) {
return (1.0 / (x * (x + 1.0))) / (Math.pow(x, -0.5) + Math.pow((x + 1.0), -0.5));
}
def code(x): return (1.0 / (x * (x + 1.0))) / (math.pow(x, -0.5) + math.pow((x + 1.0), -0.5))
function code(x) return Float64(Float64(1.0 / Float64(x * Float64(x + 1.0))) / Float64((x ^ -0.5) + (Float64(x + 1.0) ^ -0.5))) end
function tmp = code(x) tmp = (1.0 / (x * (x + 1.0))) / ((x ^ -0.5) + ((x + 1.0) ^ -0.5)); end
code[x_] := N[(N[(1.0 / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Power[x, -0.5], $MachinePrecision] + N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x \cdot \left(x + 1\right)}}{{x}^{-0.5} + {\left(x + 1\right)}^{-0.5}}
\end{array}
Initial program 67.9%
*-un-lft-identity67.9%
clear-num67.9%
associate-/r/67.9%
prod-diff67.9%
*-un-lft-identity67.9%
fma-neg67.9%
*-un-lft-identity67.9%
pow1/267.9%
pow-flip63.8%
metadata-eval63.8%
pow1/263.8%
pow-flip68.0%
+-commutative68.0%
metadata-eval68.0%
Applied egg-rr68.0%
+-commutative68.0%
sub-neg68.0%
fma-udef68.0%
distribute-lft1-in68.0%
metadata-eval68.0%
mul0-lft68.0%
+-commutative68.0%
associate-+r+68.0%
sub-neg68.0%
neg-sub068.0%
+-commutative68.0%
sub-neg68.0%
Simplified68.0%
metadata-eval68.0%
pow-flip63.8%
+-commutative63.8%
pow1/263.8%
flip--63.7%
pow-prod-up58.2%
metadata-eval58.2%
inv-pow58.2%
+-commutative58.2%
+-commutative58.2%
frac-times62.3%
metadata-eval62.3%
add-sqr-sqrt67.8%
+-commutative67.8%
pow1/267.8%
Applied egg-rr67.8%
frac-sub68.6%
*-un-lft-identity68.6%
+-commutative68.6%
+-commutative68.6%
Applied egg-rr68.6%
Taylor expanded in x around 0 88.6%
Final simplification88.6%
(FPCore (x) :precision binary64 (/ (/ (/ 1.0 x) (+ x 1.0)) (+ (pow x -0.5) (pow (+ x 1.0) -0.5))))
double code(double x) {
return ((1.0 / x) / (x + 1.0)) / (pow(x, -0.5) + pow((x + 1.0), -0.5));
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((1.0d0 / x) / (x + 1.0d0)) / ((x ** (-0.5d0)) + ((x + 1.0d0) ** (-0.5d0)))
end function
public static double code(double x) {
return ((1.0 / x) / (x + 1.0)) / (Math.pow(x, -0.5) + Math.pow((x + 1.0), -0.5));
}
def code(x): return ((1.0 / x) / (x + 1.0)) / (math.pow(x, -0.5) + math.pow((x + 1.0), -0.5))
function code(x) return Float64(Float64(Float64(1.0 / x) / Float64(x + 1.0)) / Float64((x ^ -0.5) + (Float64(x + 1.0) ^ -0.5))) end
function tmp = code(x) tmp = ((1.0 / x) / (x + 1.0)) / ((x ^ -0.5) + ((x + 1.0) ^ -0.5)); end
code[x_] := N[(N[(N[(1.0 / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[Power[x, -0.5], $MachinePrecision] + N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\frac{1}{x}}{x + 1}}{{x}^{-0.5} + {\left(x + 1\right)}^{-0.5}}
\end{array}
Initial program 67.9%
*-un-lft-identity67.9%
clear-num67.9%
associate-/r/67.9%
prod-diff67.9%
*-un-lft-identity67.9%
fma-neg67.9%
*-un-lft-identity67.9%
pow1/267.9%
pow-flip63.8%
metadata-eval63.8%
pow1/263.8%
pow-flip68.0%
+-commutative68.0%
metadata-eval68.0%
Applied egg-rr68.0%
+-commutative68.0%
sub-neg68.0%
fma-udef68.0%
distribute-lft1-in68.0%
metadata-eval68.0%
mul0-lft68.0%
+-commutative68.0%
associate-+r+68.0%
sub-neg68.0%
neg-sub068.0%
+-commutative68.0%
sub-neg68.0%
Simplified68.0%
metadata-eval68.0%
pow-flip63.8%
+-commutative63.8%
pow1/263.8%
flip--63.7%
pow-prod-up58.2%
metadata-eval58.2%
inv-pow58.2%
+-commutative58.2%
+-commutative58.2%
frac-times62.3%
metadata-eval62.3%
add-sqr-sqrt67.8%
+-commutative67.8%
pow1/267.8%
Applied egg-rr67.8%
frac-sub68.6%
*-un-lft-identity68.6%
+-commutative68.6%
+-commutative68.6%
Applied egg-rr68.6%
*-rgt-identity68.6%
associate--l+88.6%
+-inverses88.6%
metadata-eval88.6%
associate-/r*89.4%
Simplified89.4%
Final simplification89.4%
(FPCore (x) :precision binary64 (if (<= x 0.72) (- (/ 1.0 (sqrt x)) (+ 1.0 (* x (+ -0.5 (* x 0.375))))) (/ (/ (/ 1.0 x) (+ x 1.0)) (* 2.0 (sqrt (/ 1.0 x))))))
double code(double x) {
double tmp;
if (x <= 0.72) {
tmp = (1.0 / sqrt(x)) - (1.0 + (x * (-0.5 + (x * 0.375))));
} else {
tmp = ((1.0 / x) / (x + 1.0)) / (2.0 * sqrt((1.0 / x)));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.72d0) then
tmp = (1.0d0 / sqrt(x)) - (1.0d0 + (x * ((-0.5d0) + (x * 0.375d0))))
else
tmp = ((1.0d0 / x) / (x + 1.0d0)) / (2.0d0 * sqrt((1.0d0 / x)))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.72) {
tmp = (1.0 / Math.sqrt(x)) - (1.0 + (x * (-0.5 + (x * 0.375))));
} else {
tmp = ((1.0 / x) / (x + 1.0)) / (2.0 * Math.sqrt((1.0 / x)));
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.72: tmp = (1.0 / math.sqrt(x)) - (1.0 + (x * (-0.5 + (x * 0.375)))) else: tmp = ((1.0 / x) / (x + 1.0)) / (2.0 * math.sqrt((1.0 / x))) return tmp
function code(x) tmp = 0.0 if (x <= 0.72) tmp = Float64(Float64(1.0 / sqrt(x)) - Float64(1.0 + Float64(x * Float64(-0.5 + Float64(x * 0.375))))); else tmp = Float64(Float64(Float64(1.0 / x) / Float64(x + 1.0)) / Float64(2.0 * sqrt(Float64(1.0 / x)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.72) tmp = (1.0 / sqrt(x)) - (1.0 + (x * (-0.5 + (x * 0.375)))); else tmp = ((1.0 / x) / (x + 1.0)) / (2.0 * sqrt((1.0 / x))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.72], N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[(1.0 + N[(x * N[(-0.5 + N[(x * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(2.0 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.72:\\
\;\;\;\;\frac{1}{\sqrt{x}} - \left(1 + x \cdot \left(-0.5 + x \cdot 0.375\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{x}}{x + 1}}{2 \cdot \sqrt{\frac{1}{x}}}\\
\end{array}
\end{array}
if x < 0.71999999999999997Initial program 99.7%
Taylor expanded in x around 0 99.2%
*-commutative99.2%
*-commutative99.2%
unpow299.2%
associate-*l*99.2%
distribute-lft-out99.2%
Simplified99.2%
if 0.71999999999999997 < x Initial program 40.6%
*-un-lft-identity40.6%
clear-num40.6%
associate-/r/40.6%
prod-diff40.6%
*-un-lft-identity40.6%
fma-neg40.6%
*-un-lft-identity40.6%
pow1/240.6%
pow-flip32.8%
metadata-eval32.8%
pow1/232.8%
pow-flip40.6%
+-commutative40.6%
metadata-eval40.6%
Applied egg-rr40.6%
+-commutative40.6%
sub-neg40.6%
fma-udef40.6%
distribute-lft1-in40.6%
metadata-eval40.6%
mul0-lft40.6%
+-commutative40.6%
associate-+r+40.6%
sub-neg40.6%
neg-sub040.6%
+-commutative40.6%
sub-neg40.6%
Simplified40.6%
metadata-eval40.6%
pow-flip32.8%
+-commutative32.8%
pow1/232.8%
flip--32.8%
pow-prod-up23.2%
metadata-eval23.2%
inv-pow23.2%
+-commutative23.2%
+-commutative23.2%
frac-times30.8%
metadata-eval30.8%
add-sqr-sqrt40.8%
+-commutative40.8%
pow1/240.8%
Applied egg-rr40.8%
frac-sub42.3%
*-un-lft-identity42.3%
+-commutative42.3%
+-commutative42.3%
Applied egg-rr42.3%
*-rgt-identity42.3%
associate--l+79.4%
+-inverses79.4%
metadata-eval79.4%
associate-/r*81.0%
Simplified81.0%
Taylor expanded in x around inf 78.9%
Final simplification88.2%
(FPCore (x) :precision binary64 (/ (/ (/ 1.0 x) (+ x 1.0)) (+ (pow x -0.5) 1.0)))
double code(double x) {
return ((1.0 / x) / (x + 1.0)) / (pow(x, -0.5) + 1.0);
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((1.0d0 / x) / (x + 1.0d0)) / ((x ** (-0.5d0)) + 1.0d0)
end function
public static double code(double x) {
return ((1.0 / x) / (x + 1.0)) / (Math.pow(x, -0.5) + 1.0);
}
def code(x): return ((1.0 / x) / (x + 1.0)) / (math.pow(x, -0.5) + 1.0)
function code(x) return Float64(Float64(Float64(1.0 / x) / Float64(x + 1.0)) / Float64((x ^ -0.5) + 1.0)) end
function tmp = code(x) tmp = ((1.0 / x) / (x + 1.0)) / ((x ^ -0.5) + 1.0); end
code[x_] := N[(N[(N[(1.0 / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[Power[x, -0.5], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\frac{1}{x}}{x + 1}}{{x}^{-0.5} + 1}
\end{array}
Initial program 67.9%
*-un-lft-identity67.9%
clear-num67.9%
associate-/r/67.9%
prod-diff67.9%
*-un-lft-identity67.9%
fma-neg67.9%
*-un-lft-identity67.9%
pow1/267.9%
pow-flip63.8%
metadata-eval63.8%
pow1/263.8%
pow-flip68.0%
+-commutative68.0%
metadata-eval68.0%
Applied egg-rr68.0%
+-commutative68.0%
sub-neg68.0%
fma-udef68.0%
distribute-lft1-in68.0%
metadata-eval68.0%
mul0-lft68.0%
+-commutative68.0%
associate-+r+68.0%
sub-neg68.0%
neg-sub068.0%
+-commutative68.0%
sub-neg68.0%
Simplified68.0%
metadata-eval68.0%
pow-flip63.8%
+-commutative63.8%
pow1/263.8%
flip--63.7%
pow-prod-up58.2%
metadata-eval58.2%
inv-pow58.2%
+-commutative58.2%
+-commutative58.2%
frac-times62.3%
metadata-eval62.3%
add-sqr-sqrt67.8%
+-commutative67.8%
pow1/267.8%
Applied egg-rr67.8%
frac-sub68.6%
*-un-lft-identity68.6%
+-commutative68.6%
+-commutative68.6%
Applied egg-rr68.6%
*-rgt-identity68.6%
associate--l+88.6%
+-inverses88.6%
metadata-eval88.6%
associate-/r*89.4%
Simplified89.4%
Taylor expanded in x around 0 66.1%
Final simplification66.1%
(FPCore (x) :precision binary64 (if (<= x 8e+76) (+ (+ (pow x -0.5) (* x 0.5)) -1.0) 0.0))
double code(double x) {
double tmp;
if (x <= 8e+76) {
tmp = (pow(x, -0.5) + (x * 0.5)) + -1.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 8d+76) then
tmp = ((x ** (-0.5d0)) + (x * 0.5d0)) + (-1.0d0)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 8e+76) {
tmp = (Math.pow(x, -0.5) + (x * 0.5)) + -1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x): tmp = 0 if x <= 8e+76: tmp = (math.pow(x, -0.5) + (x * 0.5)) + -1.0 else: tmp = 0.0 return tmp
function code(x) tmp = 0.0 if (x <= 8e+76) tmp = Float64(Float64((x ^ -0.5) + Float64(x * 0.5)) + -1.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 8e+76) tmp = ((x ^ -0.5) + (x * 0.5)) + -1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 8e+76], N[(N[(N[Power[x, -0.5], $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 8 \cdot 10^{+76}:\\
\;\;\;\;\left({x}^{-0.5} + x \cdot 0.5\right) + -1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 8.0000000000000004e76Initial program 79.6%
*-un-lft-identity79.6%
clear-num79.6%
associate-/r/79.6%
prod-diff79.6%
*-un-lft-identity79.6%
fma-neg79.6%
*-un-lft-identity79.6%
pow1/279.6%
pow-flip80.0%
metadata-eval80.0%
pow1/280.0%
pow-flip79.8%
+-commutative79.8%
metadata-eval79.8%
Applied egg-rr79.8%
+-commutative79.8%
sub-neg79.8%
fma-udef79.8%
distribute-lft1-in79.8%
metadata-eval79.8%
mul0-lft79.8%
+-commutative79.8%
associate-+r+79.8%
sub-neg79.8%
neg-sub079.8%
+-commutative79.8%
sub-neg79.8%
Simplified79.8%
Taylor expanded in x around 0 76.9%
if 8.0000000000000004e76 < x Initial program 49.8%
*-un-lft-identity49.8%
clear-num49.8%
associate-/r/49.8%
prod-diff49.8%
*-un-lft-identity49.8%
fma-neg49.8%
*-un-lft-identity49.8%
pow1/249.8%
pow-flip38.9%
metadata-eval38.9%
pow1/238.9%
pow-flip49.8%
+-commutative49.8%
metadata-eval49.8%
Applied egg-rr49.8%
+-commutative49.8%
sub-neg49.8%
fma-udef49.8%
distribute-lft1-in49.8%
metadata-eval49.8%
mul0-lft49.8%
+-commutative49.8%
associate-+r+49.8%
sub-neg49.8%
neg-sub049.8%
+-commutative49.8%
sub-neg49.8%
Simplified49.8%
sqr-pow27.0%
metadata-eval27.0%
pow-flip30.7%
+-commutative30.7%
pow1/230.7%
fma-neg4.3%
metadata-eval4.3%
metadata-eval4.3%
pow1/24.3%
+-commutative4.3%
pow-flip4.4%
+-commutative4.4%
metadata-eval4.4%
Applied egg-rr4.4%
Taylor expanded in x around inf 49.8%
unpow1/249.8%
+-inverses49.8%
Simplified49.8%
Final simplification66.2%
(FPCore (x) :precision binary64 (if (<= x 1.0) (+ (+ (pow x -0.5) (* x 0.5)) -1.0) (/ 1.0 (* x (+ x (pow x 0.5))))))
double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = (pow(x, -0.5) + (x * 0.5)) + -1.0;
} else {
tmp = 1.0 / (x * (x + pow(x, 0.5)));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 1.0d0) then
tmp = ((x ** (-0.5d0)) + (x * 0.5d0)) + (-1.0d0)
else
tmp = 1.0d0 / (x * (x + (x ** 0.5d0)))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = (Math.pow(x, -0.5) + (x * 0.5)) + -1.0;
} else {
tmp = 1.0 / (x * (x + Math.pow(x, 0.5)));
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.0: tmp = (math.pow(x, -0.5) + (x * 0.5)) + -1.0 else: tmp = 1.0 / (x * (x + math.pow(x, 0.5))) return tmp
function code(x) tmp = 0.0 if (x <= 1.0) tmp = Float64(Float64((x ^ -0.5) + Float64(x * 0.5)) + -1.0); else tmp = Float64(1.0 / Float64(x * Float64(x + (x ^ 0.5)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.0) tmp = ((x ^ -0.5) + (x * 0.5)) + -1.0; else tmp = 1.0 / (x * (x + (x ^ 0.5))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.0], N[(N[(N[Power[x, -0.5], $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(1.0 / N[(x * N[(x + N[Power[x, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\left({x}^{-0.5} + x \cdot 0.5\right) + -1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot \left(x + {x}^{0.5}\right)}\\
\end{array}
\end{array}
if x < 1Initial program 99.7%
*-un-lft-identity99.7%
clear-num99.7%
associate-/r/99.7%
prod-diff99.7%
*-un-lft-identity99.7%
fma-neg99.7%
*-un-lft-identity99.7%
pow1/299.7%
pow-flip100.0%
metadata-eval100.0%
pow1/2100.0%
pow-flip100.0%
+-commutative100.0%
metadata-eval100.0%
Applied egg-rr100.0%
+-commutative100.0%
sub-neg100.0%
fma-udef100.0%
distribute-lft1-in100.0%
metadata-eval100.0%
mul0-lft100.0%
+-commutative100.0%
associate-+r+100.0%
sub-neg100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 99.0%
if 1 < x Initial program 40.6%
*-un-lft-identity40.6%
clear-num40.6%
associate-/r/40.6%
prod-diff40.6%
*-un-lft-identity40.6%
fma-neg40.6%
*-un-lft-identity40.6%
pow1/240.6%
pow-flip32.8%
metadata-eval32.8%
pow1/232.8%
pow-flip40.6%
+-commutative40.6%
metadata-eval40.6%
Applied egg-rr40.6%
+-commutative40.6%
sub-neg40.6%
fma-udef40.6%
distribute-lft1-in40.6%
metadata-eval40.6%
mul0-lft40.6%
+-commutative40.6%
associate-+r+40.6%
sub-neg40.6%
neg-sub040.6%
+-commutative40.6%
sub-neg40.6%
Simplified40.6%
metadata-eval40.6%
pow-flip32.8%
+-commutative32.8%
pow1/232.8%
flip--32.8%
pow-prod-up23.2%
metadata-eval23.2%
inv-pow23.2%
+-commutative23.2%
+-commutative23.2%
frac-times30.8%
metadata-eval30.8%
add-sqr-sqrt40.8%
+-commutative40.8%
pow1/240.8%
Applied egg-rr40.8%
Taylor expanded in x around 0 38.0%
Taylor expanded in x around inf 39.5%
unpow239.5%
associate-*l*39.5%
unpow1/239.5%
distribute-rgt-in39.5%
*-lft-identity39.5%
unpow1/239.5%
rem-exp-log39.5%
exp-neg39.5%
exp-prod39.5%
distribute-lft-neg-out39.5%
distribute-rgt-neg-in39.5%
metadata-eval39.5%
exp-to-pow39.5%
pow-plus39.5%
metadata-eval39.5%
Simplified39.5%
Final simplification66.9%
(FPCore (x) :precision binary64 (if (<= x 4.6e+153) (/ 1.0 (+ x (sqrt x))) 0.0))
double code(double x) {
double tmp;
if (x <= 4.6e+153) {
tmp = 1.0 / (x + sqrt(x));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 4.6d+153) then
tmp = 1.0d0 / (x + sqrt(x))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 4.6e+153) {
tmp = 1.0 / (x + Math.sqrt(x));
} else {
tmp = 0.0;
}
return tmp;
}
def code(x): tmp = 0 if x <= 4.6e+153: tmp = 1.0 / (x + math.sqrt(x)) else: tmp = 0.0 return tmp
function code(x) tmp = 0.0 if (x <= 4.6e+153) tmp = Float64(1.0 / Float64(x + sqrt(x))); else tmp = 0.0; end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 4.6e+153) tmp = 1.0 / (x + sqrt(x)); else tmp = 0.0; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 4.6e+153], N[(1.0 / N[(x + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.6 \cdot 10^{+153}:\\
\;\;\;\;\frac{1}{x + \sqrt{x}}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 4.6000000000000003e153Initial program 69.6%
*-un-lft-identity69.6%
clear-num69.6%
associate-/r/69.6%
prod-diff69.6%
*-un-lft-identity69.6%
fma-neg69.6%
*-un-lft-identity69.6%
pow1/269.6%
pow-flip69.9%
metadata-eval69.9%
pow1/269.9%
pow-flip69.8%
+-commutative69.8%
metadata-eval69.8%
Applied egg-rr69.8%
+-commutative69.8%
sub-neg69.8%
fma-udef69.8%
distribute-lft1-in69.8%
metadata-eval69.8%
mul0-lft69.8%
+-commutative69.8%
associate-+r+69.8%
sub-neg69.8%
neg-sub069.8%
+-commutative69.8%
sub-neg69.8%
Simplified69.8%
metadata-eval69.8%
pow-flip69.9%
+-commutative69.9%
pow1/269.9%
flip--69.8%
pow-prod-up69.6%
metadata-eval69.6%
inv-pow69.6%
+-commutative69.6%
+-commutative69.6%
frac-times69.5%
metadata-eval69.5%
add-sqr-sqrt69.5%
+-commutative69.5%
pow1/269.5%
Applied egg-rr69.5%
Taylor expanded in x around 0 66.4%
+-commutative66.4%
distribute-lft-in66.4%
pow166.4%
pow-prod-up66.7%
metadata-eval66.7%
pow1/266.7%
*-rgt-identity66.7%
Applied egg-rr66.7%
if 4.6000000000000003e153 < x Initial program 63.8%
*-un-lft-identity63.8%
clear-num63.8%
associate-/r/63.8%
prod-diff63.8%
*-un-lft-identity63.8%
fma-neg63.8%
*-un-lft-identity63.8%
pow1/263.8%
pow-flip49.5%
metadata-eval49.5%
pow1/249.5%
pow-flip63.8%
+-commutative63.8%
metadata-eval63.8%
Applied egg-rr63.8%
+-commutative63.8%
sub-neg63.8%
fma-udef63.8%
distribute-lft1-in63.8%
metadata-eval63.8%
mul0-lft63.8%
+-commutative63.8%
associate-+r+63.8%
sub-neg63.8%
neg-sub063.8%
+-commutative63.8%
sub-neg63.8%
Simplified63.8%
sqr-pow33.9%
metadata-eval33.9%
pow-flip38.7%
+-commutative38.7%
pow1/238.7%
fma-neg4.3%
metadata-eval4.3%
metadata-eval4.3%
pow1/24.3%
+-commutative4.3%
pow-flip4.4%
+-commutative4.4%
metadata-eval4.4%
Applied egg-rr4.4%
Taylor expanded in x around inf 63.8%
unpow1/263.8%
+-inverses63.8%
Simplified63.8%
Final simplification65.8%
(FPCore (x) :precision binary64 (if (<= x 1.0) (+ (pow x -0.5) -1.0) 0.0))
double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = pow(x, -0.5) + -1.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 1.0d0) then
tmp = (x ** (-0.5d0)) + (-1.0d0)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = Math.pow(x, -0.5) + -1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.0: tmp = math.pow(x, -0.5) + -1.0 else: tmp = 0.0 return tmp
function code(x) tmp = 0.0 if (x <= 1.0) tmp = Float64((x ^ -0.5) + -1.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.0) tmp = (x ^ -0.5) + -1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.0], N[(N[Power[x, -0.5], $MachinePrecision] + -1.0), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;{x}^{-0.5} + -1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1Initial program 99.7%
*-un-lft-identity99.7%
clear-num99.7%
associate-/r/99.7%
prod-diff99.7%
*-un-lft-identity99.7%
fma-neg99.7%
*-un-lft-identity99.7%
pow1/299.7%
pow-flip100.0%
metadata-eval100.0%
pow1/2100.0%
pow-flip100.0%
+-commutative100.0%
metadata-eval100.0%
Applied egg-rr100.0%
+-commutative100.0%
sub-neg100.0%
fma-udef100.0%
distribute-lft1-in100.0%
metadata-eval100.0%
mul0-lft100.0%
+-commutative100.0%
associate-+r+100.0%
sub-neg100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 97.8%
if 1 < x Initial program 40.6%
*-un-lft-identity40.6%
clear-num40.6%
associate-/r/40.6%
prod-diff40.6%
*-un-lft-identity40.6%
fma-neg40.6%
*-un-lft-identity40.6%
pow1/240.6%
pow-flip32.8%
metadata-eval32.8%
pow1/232.8%
pow-flip40.6%
+-commutative40.6%
metadata-eval40.6%
Applied egg-rr40.6%
+-commutative40.6%
sub-neg40.6%
fma-udef40.6%
distribute-lft1-in40.6%
metadata-eval40.6%
mul0-lft40.6%
+-commutative40.6%
associate-+r+40.6%
sub-neg40.6%
neg-sub040.6%
+-commutative40.6%
sub-neg40.6%
Simplified40.6%
sqr-pow23.9%
metadata-eval23.9%
pow-flip26.7%
+-commutative26.7%
pow1/226.7%
fma-neg7.8%
metadata-eval7.8%
metadata-eval7.8%
pow1/27.8%
+-commutative7.8%
pow-flip7.6%
+-commutative7.6%
metadata-eval7.6%
Applied egg-rr7.6%
Taylor expanded in x around inf 37.4%
unpow1/237.4%
+-inverses37.4%
Simplified37.4%
Final simplification65.3%
(FPCore (x) :precision binary64 (if (<= x 1.3e+123) (sqrt (/ 0.1111111111111111 x)) 0.0))
double code(double x) {
double tmp;
if (x <= 1.3e+123) {
tmp = sqrt((0.1111111111111111 / x));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 1.3d+123) then
tmp = sqrt((0.1111111111111111d0 / x))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 1.3e+123) {
tmp = Math.sqrt((0.1111111111111111 / x));
} else {
tmp = 0.0;
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.3e+123: tmp = math.sqrt((0.1111111111111111 / x)) else: tmp = 0.0 return tmp
function code(x) tmp = 0.0 if (x <= 1.3e+123) tmp = sqrt(Float64(0.1111111111111111 / x)); else tmp = 0.0; end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.3e+123) tmp = sqrt((0.1111111111111111 / x)); else tmp = 0.0; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.3e+123], N[Sqrt[N[(0.1111111111111111 / x), $MachinePrecision]], $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.3 \cdot 10^{+123}:\\
\;\;\;\;\sqrt{\frac{0.1111111111111111}{x}}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.29999999999999993e123Initial program 72.6%
sub-neg72.6%
flip3-+49.1%
inv-pow49.1%
pow-pow49.3%
metadata-eval49.3%
distribute-neg-frac49.3%
metadata-eval49.3%
+-commutative49.3%
frac-times49.4%
metadata-eval49.4%
add-sqr-sqrt49.1%
Applied egg-rr49.1%
cube-div49.0%
metadata-eval49.0%
cancel-sign-sub-inv49.0%
associate-*r/49.0%
associate-*l/49.0%
metadata-eval49.0%
associate-/l/49.0%
rem-square-sqrt49.0%
associate-*r/49.0%
Simplified49.0%
expm1-log1p-u45.7%
expm1-udef43.4%
sqrt-pow243.4%
metadata-eval43.4%
Applied egg-rr43.4%
expm1-def45.7%
expm1-log1p49.3%
Simplified49.3%
Taylor expanded in x around inf 14.6%
*-commutative14.6%
Simplified14.6%
add-sqr-sqrt14.6%
sqrt-unprod14.6%
inv-pow14.6%
sqrt-pow114.6%
metadata-eval14.6%
inv-pow14.6%
sqrt-pow114.6%
metadata-eval14.6%
swap-sqr14.6%
pow-prod-up14.6%
metadata-eval14.6%
inv-pow14.6%
metadata-eval14.6%
Applied egg-rr14.6%
associate-*l/14.6%
metadata-eval14.6%
Simplified14.6%
if 1.29999999999999993e123 < x Initial program 58.3%
*-un-lft-identity58.3%
clear-num58.3%
associate-/r/58.3%
prod-diff58.3%
*-un-lft-identity58.3%
fma-neg58.3%
*-un-lft-identity58.3%
pow1/258.3%
pow-flip45.4%
metadata-eval45.4%
pow1/245.4%
pow-flip58.3%
+-commutative58.3%
metadata-eval58.3%
Applied egg-rr58.3%
+-commutative58.3%
sub-neg58.3%
fma-udef58.3%
distribute-lft1-in58.3%
metadata-eval58.3%
mul0-lft58.3%
+-commutative58.3%
associate-+r+58.3%
sub-neg58.3%
neg-sub058.3%
+-commutative58.3%
sub-neg58.3%
Simplified58.3%
sqr-pow31.2%
metadata-eval31.2%
pow-flip35.6%
+-commutative35.6%
pow1/235.6%
fma-neg4.2%
metadata-eval4.2%
metadata-eval4.2%
pow1/24.2%
+-commutative4.2%
pow-flip4.3%
+-commutative4.3%
metadata-eval4.3%
Applied egg-rr4.3%
Taylor expanded in x around inf 58.3%
unpow1/258.3%
+-inverses58.3%
Simplified58.3%
Final simplification29.1%
(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 67.9%
*-un-lft-identity67.9%
clear-num67.9%
associate-/r/67.9%
prod-diff67.9%
*-un-lft-identity67.9%
fma-neg67.9%
*-un-lft-identity67.9%
pow1/267.9%
pow-flip63.8%
metadata-eval63.8%
pow1/263.8%
pow-flip68.0%
+-commutative68.0%
metadata-eval68.0%
Applied egg-rr68.0%
+-commutative68.0%
sub-neg68.0%
fma-udef68.0%
distribute-lft1-in68.0%
metadata-eval68.0%
mul0-lft68.0%
+-commutative68.0%
associate-+r+68.0%
sub-neg68.0%
neg-sub068.0%
+-commutative68.0%
sub-neg68.0%
Simplified68.0%
sqr-pow58.7%
metadata-eval58.7%
pow-flip60.2%
+-commutative60.2%
pow1/260.2%
fma-neg50.0%
metadata-eval50.0%
metadata-eval50.0%
pow1/250.0%
+-commutative50.0%
pow-flip49.8%
+-commutative49.8%
metadata-eval49.8%
Applied egg-rr49.8%
Taylor expanded in x around inf 21.4%
unpow1/221.4%
+-inverses21.4%
Simplified21.4%
Final simplification21.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 2023319
(FPCore (x)
:name "2isqrt (example 3.6)"
:precision binary64
:herbie-target
(/ 1.0 (+ (* (+ x 1.0) (sqrt x)) (* x (sqrt (+ x 1.0)))))
(- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))