
(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 12 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 (if (<= (+ (/ 1.0 (sqrt x)) (/ -1.0 (sqrt (+ 1.0 x)))) 4e-6) (/ (pow x -0.5) (+ 1.5 (- (fma 2.0 x (/ 0.0625 (* x x))) (/ 0.125 x)))) (- (pow x -0.5) (pow (+ 1.0 x) -0.5))))
double code(double x) {
double tmp;
if (((1.0 / sqrt(x)) + (-1.0 / sqrt((1.0 + x)))) <= 4e-6) {
tmp = pow(x, -0.5) / (1.5 + (fma(2.0, x, (0.0625 / (x * x))) - (0.125 / x)));
} else {
tmp = pow(x, -0.5) - pow((1.0 + x), -0.5);
}
return tmp;
}
function code(x) tmp = 0.0 if (Float64(Float64(1.0 / sqrt(x)) + Float64(-1.0 / sqrt(Float64(1.0 + x)))) <= 4e-6) tmp = Float64((x ^ -0.5) / Float64(1.5 + Float64(fma(2.0, x, Float64(0.0625 / Float64(x * x))) - Float64(0.125 / x)))); else tmp = Float64((x ^ -0.5) - (Float64(1.0 + x) ^ -0.5)); end return tmp end
code[x_] := If[LessEqual[N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4e-6], N[(N[Power[x, -0.5], $MachinePrecision] / N[(1.5 + N[(N[(2.0 * x + N[(0.0625 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.125 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] - N[Power[N[(1.0 + x), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{\sqrt{1 + x}} \leq 4 \cdot 10^{-6}:\\
\;\;\;\;\frac{{x}^{-0.5}}{1.5 + \left(\mathsf{fma}\left(2, x, \frac{0.0625}{x \cdot x}\right) - \frac{0.125}{x}\right)}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\
\end{array}
\end{array}
if (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) < 3.99999999999999982e-6Initial program 41.6%
frac-sub41.6%
div-inv41.6%
*-un-lft-identity41.6%
+-commutative41.6%
*-rgt-identity41.6%
metadata-eval41.6%
frac-times41.6%
un-div-inv41.6%
pow1/241.6%
pow-flip41.6%
metadata-eval41.6%
+-commutative41.6%
Applied egg-rr41.6%
associate-*r/41.6%
*-rgt-identity41.6%
times-frac41.6%
div-sub41.6%
*-inverses41.6%
/-rgt-identity41.6%
Simplified41.6%
*-un-lft-identity41.6%
sqrt-undiv41.9%
+-commutative41.9%
Applied egg-rr41.9%
*-lft-identity41.9%
Simplified41.9%
*-commutative41.9%
metadata-eval41.9%
sqrt-pow241.9%
inv-pow41.9%
flip--41.9%
associate-*r/41.9%
inv-pow41.9%
sqrt-pow241.9%
metadata-eval41.9%
metadata-eval41.9%
add-sqr-sqrt42.0%
+-commutative42.0%
+-commutative42.0%
Applied egg-rr42.0%
associate-/l*42.0%
Simplified42.0%
Taylor expanded in x around inf 99.7%
associate--l+99.7%
fma-def99.7%
associate-*r/99.7%
metadata-eval99.7%
unpow299.7%
associate-*r/99.7%
metadata-eval99.7%
Simplified99.7%
if 3.99999999999999982e-6 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) Initial program 99.6%
*-un-lft-identity99.6%
clear-num99.6%
associate-/r/99.6%
prod-diff99.6%
*-un-lft-identity99.6%
fma-neg99.6%
*-un-lft-identity99.6%
inv-pow99.6%
sqrt-pow2100.0%
metadata-eval100.0%
pow1/2100.0%
pow-flip100.0%
+-commutative100.0%
metadata-eval100.0%
Applied egg-rr100.0%
fma-udef100.0%
distribute-lft1-in100.0%
metadata-eval100.0%
mul0-lft100.0%
+-rgt-identity100.0%
Simplified100.0%
Final simplification99.8%
(FPCore (x) :precision binary64 (if (<= (+ (/ 1.0 (sqrt x)) (/ -1.0 (sqrt (+ 1.0 x)))) 2e-8) (/ (pow x -0.5) (+ 1.5 (- (* x 2.0) (/ 0.125 x)))) (* (pow x -0.5) (- 1.0 (sqrt (/ x (+ 1.0 x)))))))
double code(double x) {
double tmp;
if (((1.0 / sqrt(x)) + (-1.0 / sqrt((1.0 + x)))) <= 2e-8) {
tmp = pow(x, -0.5) / (1.5 + ((x * 2.0) - (0.125 / x)));
} else {
tmp = pow(x, -0.5) * (1.0 - sqrt((x / (1.0 + x))));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (((1.0d0 / sqrt(x)) + ((-1.0d0) / sqrt((1.0d0 + x)))) <= 2d-8) then
tmp = (x ** (-0.5d0)) / (1.5d0 + ((x * 2.0d0) - (0.125d0 / x)))
else
tmp = (x ** (-0.5d0)) * (1.0d0 - sqrt((x / (1.0d0 + x))))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (((1.0 / Math.sqrt(x)) + (-1.0 / Math.sqrt((1.0 + x)))) <= 2e-8) {
tmp = Math.pow(x, -0.5) / (1.5 + ((x * 2.0) - (0.125 / x)));
} else {
tmp = Math.pow(x, -0.5) * (1.0 - Math.sqrt((x / (1.0 + x))));
}
return tmp;
}
def code(x): tmp = 0 if ((1.0 / math.sqrt(x)) + (-1.0 / math.sqrt((1.0 + x)))) <= 2e-8: tmp = math.pow(x, -0.5) / (1.5 + ((x * 2.0) - (0.125 / x))) else: tmp = math.pow(x, -0.5) * (1.0 - math.sqrt((x / (1.0 + x)))) return tmp
function code(x) tmp = 0.0 if (Float64(Float64(1.0 / sqrt(x)) + Float64(-1.0 / sqrt(Float64(1.0 + x)))) <= 2e-8) tmp = Float64((x ^ -0.5) / Float64(1.5 + Float64(Float64(x * 2.0) - Float64(0.125 / x)))); else tmp = Float64((x ^ -0.5) * Float64(1.0 - sqrt(Float64(x / Float64(1.0 + x))))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (((1.0 / sqrt(x)) + (-1.0 / sqrt((1.0 + x)))) <= 2e-8) tmp = (x ^ -0.5) / (1.5 + ((x * 2.0) - (0.125 / x))); else tmp = (x ^ -0.5) * (1.0 - sqrt((x / (1.0 + x)))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e-8], N[(N[Power[x, -0.5], $MachinePrecision] / N[(1.5 + N[(N[(x * 2.0), $MachinePrecision] - N[(0.125 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] * N[(1.0 - N[Sqrt[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{\sqrt{1 + x}} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\frac{{x}^{-0.5}}{1.5 + \left(x \cdot 2 - \frac{0.125}{x}\right)}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \left(1 - \sqrt{\frac{x}{1 + x}}\right)\\
\end{array}
\end{array}
if (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) < 2e-8Initial program 41.3%
frac-sub41.3%
div-inv41.3%
*-un-lft-identity41.3%
+-commutative41.3%
*-rgt-identity41.3%
metadata-eval41.3%
frac-times41.3%
un-div-inv41.3%
pow1/241.3%
pow-flip41.3%
metadata-eval41.3%
+-commutative41.3%
Applied egg-rr41.3%
associate-*r/41.3%
*-rgt-identity41.3%
times-frac41.3%
div-sub41.3%
*-inverses41.3%
/-rgt-identity41.3%
Simplified41.3%
*-un-lft-identity41.3%
sqrt-undiv41.5%
+-commutative41.5%
Applied egg-rr41.5%
*-lft-identity41.5%
Simplified41.5%
*-commutative41.5%
metadata-eval41.5%
sqrt-pow241.5%
inv-pow41.5%
flip--41.5%
associate-*r/41.5%
inv-pow41.5%
sqrt-pow241.5%
metadata-eval41.5%
metadata-eval41.5%
add-sqr-sqrt41.6%
+-commutative41.6%
+-commutative41.6%
Applied egg-rr41.6%
associate-/l*41.6%
Simplified41.6%
Taylor expanded in x around inf 99.7%
associate--l+99.7%
*-commutative99.7%
associate-*r/99.7%
metadata-eval99.7%
Simplified99.7%
if 2e-8 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) Initial program 99.5%
frac-sub99.4%
div-inv99.4%
*-un-lft-identity99.4%
+-commutative99.4%
*-rgt-identity99.4%
metadata-eval99.4%
frac-times99.4%
un-div-inv99.4%
pow1/299.4%
pow-flip99.8%
metadata-eval99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*r/99.8%
*-rgt-identity99.8%
times-frac99.9%
div-sub99.9%
*-inverses99.9%
/-rgt-identity99.9%
Simplified99.9%
*-un-lft-identity99.9%
sqrt-undiv99.9%
+-commutative99.9%
Applied egg-rr99.9%
*-lft-identity99.9%
Simplified99.9%
Final simplification99.8%
(FPCore (x) :precision binary64 (if (<= (+ (/ 1.0 (sqrt x)) (/ -1.0 (sqrt (+ 1.0 x)))) 2e-8) (/ (pow x -0.5) (+ 1.5 (- (* x 2.0) (/ 0.125 x)))) (- (pow x -0.5) (pow (+ 1.0 x) -0.5))))
double code(double x) {
double tmp;
if (((1.0 / sqrt(x)) + (-1.0 / sqrt((1.0 + x)))) <= 2e-8) {
tmp = pow(x, -0.5) / (1.5 + ((x * 2.0) - (0.125 / x)));
} else {
tmp = pow(x, -0.5) - pow((1.0 + x), -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((1.0d0 + x)))) <= 2d-8) then
tmp = (x ** (-0.5d0)) / (1.5d0 + ((x * 2.0d0) - (0.125d0 / x)))
else
tmp = (x ** (-0.5d0)) - ((1.0d0 + x) ** (-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((1.0 + x)))) <= 2e-8) {
tmp = Math.pow(x, -0.5) / (1.5 + ((x * 2.0) - (0.125 / x)));
} else {
tmp = Math.pow(x, -0.5) - Math.pow((1.0 + x), -0.5);
}
return tmp;
}
def code(x): tmp = 0 if ((1.0 / math.sqrt(x)) + (-1.0 / math.sqrt((1.0 + x)))) <= 2e-8: tmp = math.pow(x, -0.5) / (1.5 + ((x * 2.0) - (0.125 / x))) else: tmp = math.pow(x, -0.5) - math.pow((1.0 + x), -0.5) return tmp
function code(x) tmp = 0.0 if (Float64(Float64(1.0 / sqrt(x)) + Float64(-1.0 / sqrt(Float64(1.0 + x)))) <= 2e-8) tmp = Float64((x ^ -0.5) / Float64(1.5 + Float64(Float64(x * 2.0) - Float64(0.125 / x)))); else tmp = Float64((x ^ -0.5) - (Float64(1.0 + x) ^ -0.5)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (((1.0 / sqrt(x)) + (-1.0 / sqrt((1.0 + x)))) <= 2e-8) tmp = (x ^ -0.5) / (1.5 + ((x * 2.0) - (0.125 / x))); else tmp = (x ^ -0.5) - ((1.0 + x) ^ -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[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e-8], N[(N[Power[x, -0.5], $MachinePrecision] / N[(1.5 + N[(N[(x * 2.0), $MachinePrecision] - N[(0.125 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] - N[Power[N[(1.0 + x), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{\sqrt{1 + x}} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\frac{{x}^{-0.5}}{1.5 + \left(x \cdot 2 - \frac{0.125}{x}\right)}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\
\end{array}
\end{array}
if (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) < 2e-8Initial program 41.3%
frac-sub41.3%
div-inv41.3%
*-un-lft-identity41.3%
+-commutative41.3%
*-rgt-identity41.3%
metadata-eval41.3%
frac-times41.3%
un-div-inv41.3%
pow1/241.3%
pow-flip41.3%
metadata-eval41.3%
+-commutative41.3%
Applied egg-rr41.3%
associate-*r/41.3%
*-rgt-identity41.3%
times-frac41.3%
div-sub41.3%
*-inverses41.3%
/-rgt-identity41.3%
Simplified41.3%
*-un-lft-identity41.3%
sqrt-undiv41.5%
+-commutative41.5%
Applied egg-rr41.5%
*-lft-identity41.5%
Simplified41.5%
*-commutative41.5%
metadata-eval41.5%
sqrt-pow241.5%
inv-pow41.5%
flip--41.5%
associate-*r/41.5%
inv-pow41.5%
sqrt-pow241.5%
metadata-eval41.5%
metadata-eval41.5%
add-sqr-sqrt41.6%
+-commutative41.6%
+-commutative41.6%
Applied egg-rr41.6%
associate-/l*41.6%
Simplified41.6%
Taylor expanded in x around inf 99.7%
associate--l+99.7%
*-commutative99.7%
associate-*r/99.7%
metadata-eval99.7%
Simplified99.7%
if 2e-8 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) Initial program 99.5%
*-un-lft-identity99.5%
clear-num99.5%
associate-/r/99.5%
prod-diff99.5%
*-un-lft-identity99.5%
fma-neg99.5%
*-un-lft-identity99.5%
inv-pow99.5%
sqrt-pow299.9%
metadata-eval99.9%
pow1/299.9%
pow-flip99.9%
+-commutative99.9%
metadata-eval99.9%
Applied egg-rr99.9%
fma-udef99.9%
distribute-lft1-in99.9%
metadata-eval99.9%
mul0-lft99.9%
+-rgt-identity99.9%
Simplified99.9%
Final simplification99.8%
(FPCore (x) :precision binary64 (if (<= x 0.58) (+ (pow x -0.5) (/ -1.0 (+ 1.0 (* x 0.5)))) (/ (pow x -0.5) (+ 1.5 (- (* x 2.0) (/ 0.125 x))))))
double code(double x) {
double tmp;
if (x <= 0.58) {
tmp = pow(x, -0.5) + (-1.0 / (1.0 + (x * 0.5)));
} else {
tmp = pow(x, -0.5) / (1.5 + ((x * 2.0) - (0.125 / x)));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.58d0) then
tmp = (x ** (-0.5d0)) + ((-1.0d0) / (1.0d0 + (x * 0.5d0)))
else
tmp = (x ** (-0.5d0)) / (1.5d0 + ((x * 2.0d0) - (0.125d0 / x)))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.58) {
tmp = Math.pow(x, -0.5) + (-1.0 / (1.0 + (x * 0.5)));
} else {
tmp = Math.pow(x, -0.5) / (1.5 + ((x * 2.0) - (0.125 / x)));
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.58: tmp = math.pow(x, -0.5) + (-1.0 / (1.0 + (x * 0.5))) else: tmp = math.pow(x, -0.5) / (1.5 + ((x * 2.0) - (0.125 / x))) return tmp
function code(x) tmp = 0.0 if (x <= 0.58) tmp = Float64((x ^ -0.5) + Float64(-1.0 / Float64(1.0 + Float64(x * 0.5)))); else tmp = Float64((x ^ -0.5) / Float64(1.5 + Float64(Float64(x * 2.0) - Float64(0.125 / x)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.58) tmp = (x ^ -0.5) + (-1.0 / (1.0 + (x * 0.5))); else tmp = (x ^ -0.5) / (1.5 + ((x * 2.0) - (0.125 / x))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.58], N[(N[Power[x, -0.5], $MachinePrecision] + N[(-1.0 / N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] / N[(1.5 + N[(N[(x * 2.0), $MachinePrecision] - N[(0.125 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.58:\\
\;\;\;\;{x}^{-0.5} + \frac{-1}{1 + x \cdot 0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{{x}^{-0.5}}{1.5 + \left(x \cdot 2 - \frac{0.125}{x}\right)}\\
\end{array}
\end{array}
if x < 0.57999999999999996Initial program 99.6%
Taylor expanded in x around 0 99.2%
add-log-exp4.2%
*-un-lft-identity4.2%
log-prod4.2%
metadata-eval4.2%
add-log-exp99.2%
pow1/299.2%
pow-flip99.6%
metadata-eval99.6%
Applied egg-rr99.6%
+-lft-identity99.6%
Simplified99.6%
if 0.57999999999999996 < x Initial program 41.6%
frac-sub41.6%
div-inv41.6%
*-un-lft-identity41.6%
+-commutative41.6%
*-rgt-identity41.6%
metadata-eval41.6%
frac-times41.6%
un-div-inv41.6%
pow1/241.6%
pow-flip41.6%
metadata-eval41.6%
+-commutative41.6%
Applied egg-rr41.6%
associate-*r/41.6%
*-rgt-identity41.6%
times-frac41.6%
div-sub41.6%
*-inverses41.6%
/-rgt-identity41.6%
Simplified41.6%
*-un-lft-identity41.6%
sqrt-undiv41.9%
+-commutative41.9%
Applied egg-rr41.9%
*-lft-identity41.9%
Simplified41.9%
*-commutative41.9%
metadata-eval41.9%
sqrt-pow241.9%
inv-pow41.9%
flip--41.9%
associate-*r/41.9%
inv-pow41.9%
sqrt-pow241.9%
metadata-eval41.9%
metadata-eval41.9%
add-sqr-sqrt42.0%
+-commutative42.0%
+-commutative42.0%
Applied egg-rr42.0%
associate-/l*42.0%
Simplified42.0%
Taylor expanded in x around inf 99.6%
associate--l+99.6%
*-commutative99.6%
associate-*r/99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x) :precision binary64 (if (<= x 0.62) (+ (pow x -0.5) (/ -1.0 (+ 1.0 (* x 0.5)))) (/ (pow x -0.5) (+ 1.5 (* x 2.0)))))
double code(double x) {
double tmp;
if (x <= 0.62) {
tmp = pow(x, -0.5) + (-1.0 / (1.0 + (x * 0.5)));
} else {
tmp = pow(x, -0.5) / (1.5 + (x * 2.0));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.62d0) then
tmp = (x ** (-0.5d0)) + ((-1.0d0) / (1.0d0 + (x * 0.5d0)))
else
tmp = (x ** (-0.5d0)) / (1.5d0 + (x * 2.0d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.62) {
tmp = Math.pow(x, -0.5) + (-1.0 / (1.0 + (x * 0.5)));
} else {
tmp = Math.pow(x, -0.5) / (1.5 + (x * 2.0));
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.62: tmp = math.pow(x, -0.5) + (-1.0 / (1.0 + (x * 0.5))) else: tmp = math.pow(x, -0.5) / (1.5 + (x * 2.0)) return tmp
function code(x) tmp = 0.0 if (x <= 0.62) tmp = Float64((x ^ -0.5) + Float64(-1.0 / Float64(1.0 + Float64(x * 0.5)))); else tmp = Float64((x ^ -0.5) / Float64(1.5 + Float64(x * 2.0))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.62) tmp = (x ^ -0.5) + (-1.0 / (1.0 + (x * 0.5))); else tmp = (x ^ -0.5) / (1.5 + (x * 2.0)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.62], N[(N[Power[x, -0.5], $MachinePrecision] + N[(-1.0 / N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] / N[(1.5 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.62:\\
\;\;\;\;{x}^{-0.5} + \frac{-1}{1 + x \cdot 0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{{x}^{-0.5}}{1.5 + x \cdot 2}\\
\end{array}
\end{array}
if x < 0.619999999999999996Initial program 99.6%
Taylor expanded in x around 0 99.2%
add-log-exp4.2%
*-un-lft-identity4.2%
log-prod4.2%
metadata-eval4.2%
add-log-exp99.2%
pow1/299.2%
pow-flip99.6%
metadata-eval99.6%
Applied egg-rr99.6%
+-lft-identity99.6%
Simplified99.6%
if 0.619999999999999996 < x Initial program 41.6%
frac-sub41.6%
div-inv41.6%
*-un-lft-identity41.6%
+-commutative41.6%
*-rgt-identity41.6%
metadata-eval41.6%
frac-times41.6%
un-div-inv41.6%
pow1/241.6%
pow-flip41.6%
metadata-eval41.6%
+-commutative41.6%
Applied egg-rr41.6%
associate-*r/41.6%
*-rgt-identity41.6%
times-frac41.6%
div-sub41.6%
*-inverses41.6%
/-rgt-identity41.6%
Simplified41.6%
*-un-lft-identity41.6%
sqrt-undiv41.9%
+-commutative41.9%
Applied egg-rr41.9%
*-lft-identity41.9%
Simplified41.9%
*-commutative41.9%
metadata-eval41.9%
sqrt-pow241.9%
inv-pow41.9%
flip--41.9%
associate-*r/41.9%
inv-pow41.9%
sqrt-pow241.9%
metadata-eval41.9%
metadata-eval41.9%
add-sqr-sqrt42.0%
+-commutative42.0%
+-commutative42.0%
Applied egg-rr42.0%
associate-/l*42.0%
Simplified42.0%
Taylor expanded in x around inf 99.2%
+-commutative99.2%
*-commutative99.2%
Simplified99.2%
Final simplification99.4%
(FPCore (x) :precision binary64 (if (<= x 1.0) (+ (+ (pow x -0.5) (* x 0.5)) -1.0) (* 0.5 (pow x -1.5))))
double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = (pow(x, -0.5) + (x * 0.5)) + -1.0;
} else {
tmp = 0.5 * pow(x, -1.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 = 0.5d0 * (x ** (-1.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 = 0.5 * Math.pow(x, -1.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 = 0.5 * math.pow(x, -1.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(0.5 * (x ^ -1.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 = 0.5 * (x ^ -1.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[(0.5 * N[Power[x, -1.5], $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}:\\
\;\;\;\;0.5 \cdot {x}^{-1.5}\\
\end{array}
\end{array}
if x < 1Initial program 99.6%
*-un-lft-identity99.6%
clear-num99.6%
associate-/r/99.6%
prod-diff99.6%
*-un-lft-identity99.6%
fma-neg99.6%
*-un-lft-identity99.6%
inv-pow99.6%
sqrt-pow2100.0%
metadata-eval100.0%
pow1/2100.0%
pow-flip100.0%
+-commutative100.0%
metadata-eval100.0%
Applied egg-rr100.0%
fma-udef100.0%
distribute-lft1-in100.0%
metadata-eval100.0%
mul0-lft100.0%
+-rgt-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 99.6%
if 1 < x Initial program 41.6%
frac-sub41.6%
div-inv41.6%
*-un-lft-identity41.6%
+-commutative41.6%
*-rgt-identity41.6%
metadata-eval41.6%
frac-times41.6%
un-div-inv41.6%
pow1/241.6%
pow-flip41.6%
metadata-eval41.6%
+-commutative41.6%
Applied egg-rr41.6%
associate-*r/41.6%
*-rgt-identity41.6%
times-frac41.6%
div-sub41.6%
*-inverses41.6%
/-rgt-identity41.6%
Simplified41.6%
Taylor expanded in x around inf 97.9%
expm1-log1p-u97.9%
expm1-udef40.1%
Applied egg-rr40.1%
expm1-def98.3%
expm1-log1p98.3%
Simplified98.3%
Final simplification98.9%
(FPCore (x) :precision binary64 (if (<= x 0.4) (+ (+ (pow x -0.5) (* x 0.5)) -1.0) (/ (pow x -0.5) (+ 1.5 (* x 2.0)))))
double code(double x) {
double tmp;
if (x <= 0.4) {
tmp = (pow(x, -0.5) + (x * 0.5)) + -1.0;
} else {
tmp = pow(x, -0.5) / (1.5 + (x * 2.0));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.4d0) then
tmp = ((x ** (-0.5d0)) + (x * 0.5d0)) + (-1.0d0)
else
tmp = (x ** (-0.5d0)) / (1.5d0 + (x * 2.0d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.4) {
tmp = (Math.pow(x, -0.5) + (x * 0.5)) + -1.0;
} else {
tmp = Math.pow(x, -0.5) / (1.5 + (x * 2.0));
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.4: tmp = (math.pow(x, -0.5) + (x * 0.5)) + -1.0 else: tmp = math.pow(x, -0.5) / (1.5 + (x * 2.0)) return tmp
function code(x) tmp = 0.0 if (x <= 0.4) tmp = Float64(Float64((x ^ -0.5) + Float64(x * 0.5)) + -1.0); else tmp = Float64((x ^ -0.5) / Float64(1.5 + Float64(x * 2.0))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.4) tmp = ((x ^ -0.5) + (x * 0.5)) + -1.0; else tmp = (x ^ -0.5) / (1.5 + (x * 2.0)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.4], N[(N[(N[Power[x, -0.5], $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] / N[(1.5 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.4:\\
\;\;\;\;\left({x}^{-0.5} + x \cdot 0.5\right) + -1\\
\mathbf{else}:\\
\;\;\;\;\frac{{x}^{-0.5}}{1.5 + x \cdot 2}\\
\end{array}
\end{array}
if x < 0.40000000000000002Initial program 99.6%
*-un-lft-identity99.6%
clear-num99.6%
associate-/r/99.6%
prod-diff99.6%
*-un-lft-identity99.6%
fma-neg99.6%
*-un-lft-identity99.6%
inv-pow99.6%
sqrt-pow2100.0%
metadata-eval100.0%
pow1/2100.0%
pow-flip100.0%
+-commutative100.0%
metadata-eval100.0%
Applied egg-rr100.0%
fma-udef100.0%
distribute-lft1-in100.0%
metadata-eval100.0%
mul0-lft100.0%
+-rgt-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 99.6%
if 0.40000000000000002 < x Initial program 41.6%
frac-sub41.6%
div-inv41.6%
*-un-lft-identity41.6%
+-commutative41.6%
*-rgt-identity41.6%
metadata-eval41.6%
frac-times41.6%
un-div-inv41.6%
pow1/241.6%
pow-flip41.6%
metadata-eval41.6%
+-commutative41.6%
Applied egg-rr41.6%
associate-*r/41.6%
*-rgt-identity41.6%
times-frac41.6%
div-sub41.6%
*-inverses41.6%
/-rgt-identity41.6%
Simplified41.6%
*-un-lft-identity41.6%
sqrt-undiv41.9%
+-commutative41.9%
Applied egg-rr41.9%
*-lft-identity41.9%
Simplified41.9%
*-commutative41.9%
metadata-eval41.9%
sqrt-pow241.9%
inv-pow41.9%
flip--41.9%
associate-*r/41.9%
inv-pow41.9%
sqrt-pow241.9%
metadata-eval41.9%
metadata-eval41.9%
add-sqr-sqrt42.0%
+-commutative42.0%
+-commutative42.0%
Applied egg-rr42.0%
associate-/l*42.0%
Simplified42.0%
Taylor expanded in x around inf 99.2%
+-commutative99.2%
*-commutative99.2%
Simplified99.2%
Final simplification99.4%
(FPCore (x) :precision binary64 (if (<= x 8.5e+122) (sqrt (/ 1.0 x)) (* (pow x -0.5) 0.0)))
double code(double x) {
double tmp;
if (x <= 8.5e+122) {
tmp = sqrt((1.0 / x));
} else {
tmp = pow(x, -0.5) * 0.0;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 8.5d+122) then
tmp = sqrt((1.0d0 / x))
else
tmp = (x ** (-0.5d0)) * 0.0d0
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 8.5e+122) {
tmp = Math.sqrt((1.0 / x));
} else {
tmp = Math.pow(x, -0.5) * 0.0;
}
return tmp;
}
def code(x): tmp = 0 if x <= 8.5e+122: tmp = math.sqrt((1.0 / x)) else: tmp = math.pow(x, -0.5) * 0.0 return tmp
function code(x) tmp = 0.0 if (x <= 8.5e+122) tmp = sqrt(Float64(1.0 / x)); else tmp = Float64((x ^ -0.5) * 0.0); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 8.5e+122) tmp = sqrt((1.0 / x)); else tmp = (x ^ -0.5) * 0.0; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 8.5e+122], N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] * 0.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 8.5 \cdot 10^{+122}:\\
\;\;\;\;\sqrt{\frac{1}{x}}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot 0\\
\end{array}
\end{array}
if x < 8.50000000000000003e122Initial program 72.7%
Taylor expanded in x around 0 71.5%
add-log-exp4.2%
*-un-lft-identity4.2%
log-prod4.2%
metadata-eval4.2%
add-log-exp71.5%
pow1/271.5%
pow-flip71.8%
metadata-eval71.8%
Applied egg-rr71.8%
+-lft-identity71.8%
Simplified71.8%
Taylor expanded in x around inf 68.2%
if 8.50000000000000003e122 < x Initial program 62.4%
sub-neg62.4%
+-commutative62.4%
add-sqr-sqrt35.6%
distribute-rgt-neg-in35.6%
fma-def4.5%
inv-pow4.5%
sqrt-pow24.5%
+-commutative4.5%
metadata-eval4.5%
inv-pow4.5%
sqrt-pow24.5%
+-commutative4.5%
metadata-eval4.5%
pow1/24.5%
pow-flip4.4%
metadata-eval4.4%
Applied egg-rr4.4%
Taylor expanded in x around inf 62.4%
unpow1/262.4%
distribute-rgt1-in62.4%
metadata-eval62.4%
unpow1/262.4%
unpow-162.4%
metadata-eval62.4%
pow-sqr62.4%
rem-sqrt-square62.4%
metadata-eval62.4%
pow-sqr62.4%
fabs-sqr62.4%
pow-sqr62.4%
metadata-eval62.4%
Simplified62.4%
Final simplification66.4%
(FPCore (x) :precision binary64 (if (<= x 0.5) (sqrt (/ 1.0 x)) (* 0.5 (pow x -1.5))))
double code(double x) {
double tmp;
if (x <= 0.5) {
tmp = sqrt((1.0 / x));
} else {
tmp = 0.5 * pow(x, -1.5);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.5d0) then
tmp = sqrt((1.0d0 / x))
else
tmp = 0.5d0 * (x ** (-1.5d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.5) {
tmp = Math.sqrt((1.0 / x));
} else {
tmp = 0.5 * Math.pow(x, -1.5);
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.5: tmp = math.sqrt((1.0 / x)) else: tmp = 0.5 * math.pow(x, -1.5) return tmp
function code(x) tmp = 0.0 if (x <= 0.5) tmp = sqrt(Float64(1.0 / x)); else tmp = Float64(0.5 * (x ^ -1.5)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.5) tmp = sqrt((1.0 / x)); else tmp = 0.5 * (x ^ -1.5); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.5], N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision], N[(0.5 * N[Power[x, -1.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.5:\\
\;\;\;\;\sqrt{\frac{1}{x}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {x}^{-1.5}\\
\end{array}
\end{array}
if x < 0.5Initial program 99.6%
Taylor expanded in x around 0 99.2%
add-log-exp4.2%
*-un-lft-identity4.2%
log-prod4.2%
metadata-eval4.2%
add-log-exp99.2%
pow1/299.2%
pow-flip99.6%
metadata-eval99.6%
Applied egg-rr99.6%
+-lft-identity99.6%
Simplified99.6%
Taylor expanded in x around inf 94.4%
if 0.5 < x Initial program 41.6%
frac-sub41.6%
div-inv41.6%
*-un-lft-identity41.6%
+-commutative41.6%
*-rgt-identity41.6%
metadata-eval41.6%
frac-times41.6%
un-div-inv41.6%
pow1/241.6%
pow-flip41.6%
metadata-eval41.6%
+-commutative41.6%
Applied egg-rr41.6%
associate-*r/41.6%
*-rgt-identity41.6%
times-frac41.6%
div-sub41.6%
*-inverses41.6%
/-rgt-identity41.6%
Simplified41.6%
Taylor expanded in x around inf 97.9%
expm1-log1p-u97.9%
expm1-udef40.1%
Applied egg-rr40.1%
expm1-def98.3%
expm1-log1p98.3%
Simplified98.3%
Final simplification96.4%
(FPCore (x) :precision binary64 (if (<= x 0.5) (pow x -0.5) (* 0.5 (pow x -1.5))))
double code(double x) {
double tmp;
if (x <= 0.5) {
tmp = pow(x, -0.5);
} else {
tmp = 0.5 * pow(x, -1.5);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.5d0) then
tmp = x ** (-0.5d0)
else
tmp = 0.5d0 * (x ** (-1.5d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.5) {
tmp = Math.pow(x, -0.5);
} else {
tmp = 0.5 * Math.pow(x, -1.5);
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.5: tmp = math.pow(x, -0.5) else: tmp = 0.5 * math.pow(x, -1.5) return tmp
function code(x) tmp = 0.0 if (x <= 0.5) tmp = x ^ -0.5; else tmp = Float64(0.5 * (x ^ -1.5)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.5) tmp = x ^ -0.5; else tmp = 0.5 * (x ^ -1.5); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.5], N[Power[x, -0.5], $MachinePrecision], N[(0.5 * N[Power[x, -1.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.5:\\
\;\;\;\;{x}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {x}^{-1.5}\\
\end{array}
\end{array}
if x < 0.5Initial program 99.6%
frac-sub99.6%
div-inv99.6%
*-un-lft-identity99.6%
+-commutative99.6%
*-rgt-identity99.6%
metadata-eval99.6%
frac-times99.5%
un-div-inv99.5%
pow1/299.5%
pow-flip100.0%
metadata-eval100.0%
+-commutative100.0%
Applied egg-rr100.0%
associate-*r/100.0%
*-rgt-identity100.0%
times-frac100.0%
div-sub100.0%
*-inverses100.0%
/-rgt-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 94.7%
if 0.5 < x Initial program 41.6%
frac-sub41.6%
div-inv41.6%
*-un-lft-identity41.6%
+-commutative41.6%
*-rgt-identity41.6%
metadata-eval41.6%
frac-times41.6%
un-div-inv41.6%
pow1/241.6%
pow-flip41.6%
metadata-eval41.6%
+-commutative41.6%
Applied egg-rr41.6%
associate-*r/41.6%
*-rgt-identity41.6%
times-frac41.6%
div-sub41.6%
*-inverses41.6%
/-rgt-identity41.6%
Simplified41.6%
Taylor expanded in x around inf 97.9%
expm1-log1p-u97.9%
expm1-udef40.1%
Applied egg-rr40.1%
expm1-def98.3%
expm1-log1p98.3%
Simplified98.3%
Final simplification96.6%
(FPCore (x) :precision binary64 (if (<= x 0.68) (+ (pow x -0.5) -1.0) (* 0.5 (pow x -1.5))))
double code(double x) {
double tmp;
if (x <= 0.68) {
tmp = pow(x, -0.5) + -1.0;
} else {
tmp = 0.5 * pow(x, -1.5);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.68d0) then
tmp = (x ** (-0.5d0)) + (-1.0d0)
else
tmp = 0.5d0 * (x ** (-1.5d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.68) {
tmp = Math.pow(x, -0.5) + -1.0;
} else {
tmp = 0.5 * Math.pow(x, -1.5);
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.68: tmp = math.pow(x, -0.5) + -1.0 else: tmp = 0.5 * math.pow(x, -1.5) return tmp
function code(x) tmp = 0.0 if (x <= 0.68) tmp = Float64((x ^ -0.5) + -1.0); else tmp = Float64(0.5 * (x ^ -1.5)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.68) tmp = (x ^ -0.5) + -1.0; else tmp = 0.5 * (x ^ -1.5); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.68], N[(N[Power[x, -0.5], $MachinePrecision] + -1.0), $MachinePrecision], N[(0.5 * N[Power[x, -1.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.68:\\
\;\;\;\;{x}^{-0.5} + -1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {x}^{-1.5}\\
\end{array}
\end{array}
if x < 0.680000000000000049Initial program 99.6%
*-un-lft-identity99.6%
clear-num99.6%
associate-/r/99.6%
prod-diff99.6%
*-un-lft-identity99.6%
fma-neg99.6%
*-un-lft-identity99.6%
inv-pow99.6%
sqrt-pow2100.0%
metadata-eval100.0%
pow1/2100.0%
pow-flip100.0%
+-commutative100.0%
metadata-eval100.0%
Applied egg-rr100.0%
fma-udef100.0%
distribute-lft1-in100.0%
metadata-eval100.0%
mul0-lft100.0%
+-rgt-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 99.3%
if 0.680000000000000049 < x Initial program 41.6%
frac-sub41.6%
div-inv41.6%
*-un-lft-identity41.6%
+-commutative41.6%
*-rgt-identity41.6%
metadata-eval41.6%
frac-times41.6%
un-div-inv41.6%
pow1/241.6%
pow-flip41.6%
metadata-eval41.6%
+-commutative41.6%
Applied egg-rr41.6%
associate-*r/41.6%
*-rgt-identity41.6%
times-frac41.6%
div-sub41.6%
*-inverses41.6%
/-rgt-identity41.6%
Simplified41.6%
Taylor expanded in x around inf 97.9%
expm1-log1p-u97.9%
expm1-udef40.1%
Applied egg-rr40.1%
expm1-def98.3%
expm1-log1p98.3%
Simplified98.3%
Final simplification98.8%
(FPCore (x) :precision binary64 (sqrt (/ 1.0 x)))
double code(double x) {
return sqrt((1.0 / x));
}
real(8) function code(x)
real(8), intent (in) :: x
code = sqrt((1.0d0 / x))
end function
public static double code(double x) {
return Math.sqrt((1.0 / x));
}
def code(x): return math.sqrt((1.0 / x))
function code(x) return sqrt(Float64(1.0 / x)) end
function tmp = code(x) tmp = sqrt((1.0 / x)); end
code[x_] := N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{1}{x}}
\end{array}
Initial program 69.5%
Taylor expanded in x around 0 50.6%
add-log-exp4.8%
*-un-lft-identity4.8%
log-prod4.8%
metadata-eval4.8%
add-log-exp50.6%
pow1/250.6%
pow-flip50.8%
metadata-eval50.8%
Applied egg-rr50.8%
+-lft-identity50.8%
Simplified50.8%
Taylor expanded in x around inf 48.3%
Final simplification48.3%
(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 2023263
(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)))))