
(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 18 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) (* (/ 1.0 (+ (sqrt x) (sqrt (+ x 1.0)))) (pow (+ x 1.0) -0.5))))
double code(double x) {
return pow(x, -0.5) * ((1.0 / (sqrt(x) + sqrt((x + 1.0)))) * pow((x + 1.0), -0.5));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (x ** (-0.5d0)) * ((1.0d0 / (sqrt(x) + sqrt((x + 1.0d0)))) * ((x + 1.0d0) ** (-0.5d0)))
end function
public static double code(double x) {
return Math.pow(x, -0.5) * ((1.0 / (Math.sqrt(x) + Math.sqrt((x + 1.0)))) * Math.pow((x + 1.0), -0.5));
}
def code(x): return math.pow(x, -0.5) * ((1.0 / (math.sqrt(x) + math.sqrt((x + 1.0)))) * math.pow((x + 1.0), -0.5))
function code(x) return Float64((x ^ -0.5) * Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(x + 1.0)))) * (Float64(x + 1.0) ^ -0.5))) end
function tmp = code(x) tmp = (x ^ -0.5) * ((1.0 / (sqrt(x) + sqrt((x + 1.0)))) * ((x + 1.0) ^ -0.5)); end
code[x_] := N[(N[Power[x, -0.5], $MachinePrecision] * N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{x}^{-0.5} \cdot \left(\frac{1}{\sqrt{x} + \sqrt{x + 1}} \cdot {\left(x + 1\right)}^{-0.5}\right)
\end{array}
Initial program 70.9%
frac-sub70.9%
div-inv70.9%
*-un-lft-identity70.9%
+-commutative70.9%
*-rgt-identity70.9%
metadata-eval70.9%
frac-times70.9%
un-div-inv70.9%
pow1/271.0%
pow-flip71.2%
metadata-eval71.2%
+-commutative71.2%
Applied egg-rr71.2%
associate-*r/71.2%
Simplified71.2%
flip--71.4%
div-inv71.4%
add-sqr-sqrt62.8%
add-sqr-sqrt72.0%
associate--l+99.6%
Applied egg-rr99.6%
+-inverses99.6%
metadata-eval99.6%
*-lft-identity99.6%
Simplified99.6%
div-inv99.6%
pow1/299.6%
pow-flip99.7%
metadata-eval99.7%
metadata-eval99.7%
pow-pow97.5%
pow1/399.5%
metadata-eval99.5%
pow-flip99.3%
pow1/299.3%
*-commutative99.3%
associate-*l*99.3%
pow1/299.3%
pow-flip99.5%
metadata-eval99.5%
pow1/397.5%
pow-pow99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (x)
:precision binary64
(let* ((t_0 (sqrt (+ x 1.0))))
(if (<= (+ (/ 1.0 (sqrt x)) (/ -1.0 t_0)) 5e-17)
(/ (/ 0.5 x) t_0)
(- (pow x -0.5) (pow (+ x 1.0) -0.5)))))
double code(double x) {
double t_0 = sqrt((x + 1.0));
double tmp;
if (((1.0 / sqrt(x)) + (-1.0 / t_0)) <= 5e-17) {
tmp = (0.5 / x) / t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = sqrt((x + 1.0d0))
if (((1.0d0 / sqrt(x)) + ((-1.0d0) / t_0)) <= 5d-17) then
tmp = (0.5d0 / x) / t_0
else
tmp = (x ** (-0.5d0)) - ((x + 1.0d0) ** (-0.5d0))
end if
code = tmp
end function
public static double code(double x) {
double t_0 = Math.sqrt((x + 1.0));
double tmp;
if (((1.0 / Math.sqrt(x)) + (-1.0 / t_0)) <= 5e-17) {
tmp = (0.5 / x) / t_0;
} else {
tmp = Math.pow(x, -0.5) - Math.pow((x + 1.0), -0.5);
}
return tmp;
}
def code(x): t_0 = math.sqrt((x + 1.0)) tmp = 0 if ((1.0 / math.sqrt(x)) + (-1.0 / t_0)) <= 5e-17: tmp = (0.5 / x) / t_0 else: tmp = math.pow(x, -0.5) - math.pow((x + 1.0), -0.5) return tmp
function code(x) t_0 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (Float64(Float64(1.0 / sqrt(x)) + Float64(-1.0 / t_0)) <= 5e-17) tmp = Float64(Float64(0.5 / x) / t_0); else tmp = Float64((x ^ -0.5) - (Float64(x + 1.0) ^ -0.5)); end return tmp end
function tmp_2 = code(x) t_0 = sqrt((x + 1.0)); tmp = 0.0; if (((1.0 / sqrt(x)) + (-1.0 / t_0)) <= 5e-17) tmp = (0.5 / x) / t_0; else tmp = (x ^ -0.5) - ((x + 1.0) ^ -0.5); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], 5e-17], N[(N[(0.5 / x), $MachinePrecision] / t$95$0), $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}
t_0 := \sqrt{x + 1}\\
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{t_0} \leq 5 \cdot 10^{-17}:\\
\;\;\;\;\frac{\frac{0.5}{x}}{t_0}\\
\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.9999999999999999e-17Initial program 42.9%
frac-sub42.9%
div-inv42.9%
*-un-lft-identity42.9%
+-commutative42.9%
*-rgt-identity42.9%
metadata-eval42.9%
frac-times42.9%
un-div-inv42.9%
pow1/242.9%
pow-flip42.9%
metadata-eval42.9%
+-commutative42.9%
Applied egg-rr42.9%
associate-*r/42.9%
Simplified42.9%
flip--43.3%
div-inv43.3%
add-sqr-sqrt26.1%
add-sqr-sqrt44.2%
associate--l+99.4%
Applied egg-rr99.4%
+-inverses99.4%
metadata-eval99.4%
*-lft-identity99.4%
Simplified99.4%
Taylor expanded in x around inf 99.2%
if 4.9999999999999999e-17 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) Initial program 98.9%
*-un-lft-identity98.9%
clear-num98.9%
associate-/r/98.9%
prod-diff98.9%
*-un-lft-identity98.9%
fma-neg98.9%
*-un-lft-identity98.9%
inv-pow98.9%
sqrt-pow299.4%
metadata-eval99.4%
pow1/299.4%
pow-flip99.4%
+-commutative99.4%
metadata-eval99.4%
Applied egg-rr99.4%
fma-udef99.4%
distribute-lft1-in99.4%
metadata-eval99.4%
mul0-lft99.4%
+-rgt-identity99.4%
Simplified99.4%
Final simplification99.3%
(FPCore (x) :precision binary64 (if (<= x 4e+80) (sqrt (/ (pow (+ (sqrt x) (sqrt (+ x 1.0))) -2.0) (* x (+ x 1.0)))) (* (pow x -0.5) (/ 0.5 x))))
double code(double x) {
double tmp;
if (x <= 4e+80) {
tmp = sqrt((pow((sqrt(x) + sqrt((x + 1.0))), -2.0) / (x * (x + 1.0))));
} else {
tmp = pow(x, -0.5) * (0.5 / x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 4d+80) then
tmp = sqrt((((sqrt(x) + sqrt((x + 1.0d0))) ** (-2.0d0)) / (x * (x + 1.0d0))))
else
tmp = (x ** (-0.5d0)) * (0.5d0 / x)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 4e+80) {
tmp = Math.sqrt((Math.pow((Math.sqrt(x) + Math.sqrt((x + 1.0))), -2.0) / (x * (x + 1.0))));
} else {
tmp = Math.pow(x, -0.5) * (0.5 / x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 4e+80: tmp = math.sqrt((math.pow((math.sqrt(x) + math.sqrt((x + 1.0))), -2.0) / (x * (x + 1.0)))) else: tmp = math.pow(x, -0.5) * (0.5 / x) return tmp
function code(x) tmp = 0.0 if (x <= 4e+80) tmp = sqrt(Float64((Float64(sqrt(x) + sqrt(Float64(x + 1.0))) ^ -2.0) / Float64(x * Float64(x + 1.0)))); else tmp = Float64((x ^ -0.5) * Float64(0.5 / x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 4e+80) tmp = sqrt((((sqrt(x) + sqrt((x + 1.0))) ^ -2.0) / (x * (x + 1.0)))); else tmp = (x ^ -0.5) * (0.5 / x); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 4e+80], N[Sqrt[N[(N[Power[N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] * N[(0.5 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4 \cdot 10^{+80}:\\
\;\;\;\;\sqrt{\frac{{\left(\sqrt{x} + \sqrt{x + 1}\right)}^{-2}}{x \cdot \left(x + 1\right)}}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{0.5}{x}\\
\end{array}
\end{array}
if x < 4e80Initial program 81.1%
frac-sub81.1%
div-inv81.1%
*-un-lft-identity81.1%
+-commutative81.1%
*-rgt-identity81.1%
metadata-eval81.1%
frac-times81.1%
un-div-inv81.1%
pow1/281.1%
pow-flip81.5%
metadata-eval81.5%
+-commutative81.5%
Applied egg-rr81.5%
associate-*r/81.5%
Simplified81.5%
flip--81.8%
div-inv81.8%
add-sqr-sqrt82.4%
add-sqr-sqrt82.9%
associate--l+99.7%
Applied egg-rr99.7%
+-inverses99.7%
metadata-eval99.7%
*-lft-identity99.7%
Simplified99.7%
add-sqr-sqrt99.1%
sqrt-unprod99.7%
frac-times99.7%
Applied egg-rr99.7%
associate-*l/99.7%
*-lft-identity99.7%
associate-/l/99.7%
+-commutative99.7%
*-commutative99.7%
+-commutative99.7%
Simplified99.7%
if 4e80 < x Initial program 54.2%
frac-sub54.2%
div-inv54.2%
*-un-lft-identity54.2%
+-commutative54.2%
*-rgt-identity54.2%
metadata-eval54.2%
frac-times54.2%
un-div-inv54.2%
pow1/254.2%
pow-flip54.2%
metadata-eval54.2%
+-commutative54.2%
Applied egg-rr54.2%
associate-*r/54.2%
Simplified54.2%
flip--54.2%
div-inv54.2%
add-sqr-sqrt30.6%
add-sqr-sqrt54.2%
associate--l+99.5%
Applied egg-rr99.5%
+-inverses99.5%
metadata-eval99.5%
*-lft-identity99.5%
Simplified99.5%
div-inv99.5%
pow1/299.5%
pow-flip99.6%
metadata-eval99.6%
metadata-eval99.6%
pow-pow95.6%
pow1/399.3%
metadata-eval99.3%
pow-flip99.2%
pow1/299.2%
*-commutative99.2%
associate-*l*99.2%
pow1/299.2%
pow-flip99.3%
metadata-eval99.3%
pow1/395.6%
pow-pow99.6%
metadata-eval99.6%
Applied egg-rr99.6%
Taylor expanded in x around inf 99.7%
Final simplification99.7%
(FPCore (x) :precision binary64 (* (pow (+ x 1.0) -0.5) (/ (pow x -0.5) (+ (sqrt x) (sqrt (+ x 1.0))))))
double code(double x) {
return pow((x + 1.0), -0.5) * (pow(x, -0.5) / (sqrt(x) + sqrt((x + 1.0))));
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((x + 1.0d0) ** (-0.5d0)) * ((x ** (-0.5d0)) / (sqrt(x) + sqrt((x + 1.0d0))))
end function
public static double code(double x) {
return Math.pow((x + 1.0), -0.5) * (Math.pow(x, -0.5) / (Math.sqrt(x) + Math.sqrt((x + 1.0))));
}
def code(x): return math.pow((x + 1.0), -0.5) * (math.pow(x, -0.5) / (math.sqrt(x) + math.sqrt((x + 1.0))))
function code(x) return Float64((Float64(x + 1.0) ^ -0.5) * Float64((x ^ -0.5) / Float64(sqrt(x) + sqrt(Float64(x + 1.0))))) end
function tmp = code(x) tmp = ((x + 1.0) ^ -0.5) * ((x ^ -0.5) / (sqrt(x) + sqrt((x + 1.0)))); end
code[x_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision] * N[(N[Power[x, -0.5], $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{-0.5} \cdot \frac{{x}^{-0.5}}{\sqrt{x} + \sqrt{x + 1}}
\end{array}
Initial program 70.9%
frac-sub70.9%
div-inv70.9%
*-un-lft-identity70.9%
+-commutative70.9%
*-rgt-identity70.9%
metadata-eval70.9%
frac-times70.9%
un-div-inv70.9%
pow1/271.0%
pow-flip71.2%
metadata-eval71.2%
+-commutative71.2%
Applied egg-rr71.2%
associate-*r/71.2%
Simplified71.2%
flip--71.4%
div-inv71.4%
add-sqr-sqrt62.8%
add-sqr-sqrt72.0%
associate--l+99.6%
Applied egg-rr99.6%
+-inverses99.6%
metadata-eval99.6%
*-lft-identity99.6%
Simplified99.6%
clear-num98.7%
associate-/r/99.6%
pow1/299.6%
pow-flip99.7%
metadata-eval99.7%
associate-*l/99.6%
*-un-lft-identity99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (x) :precision binary64 (/ (pow (+ x 1.0) -0.5) (/ (+ (sqrt x) (sqrt (+ x 1.0))) (pow x -0.5))))
double code(double x) {
return pow((x + 1.0), -0.5) / ((sqrt(x) + sqrt((x + 1.0))) / pow(x, -0.5));
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((x + 1.0d0) ** (-0.5d0)) / ((sqrt(x) + sqrt((x + 1.0d0))) / (x ** (-0.5d0)))
end function
public static double code(double x) {
return Math.pow((x + 1.0), -0.5) / ((Math.sqrt(x) + Math.sqrt((x + 1.0))) / Math.pow(x, -0.5));
}
def code(x): return math.pow((x + 1.0), -0.5) / ((math.sqrt(x) + math.sqrt((x + 1.0))) / math.pow(x, -0.5))
function code(x) return Float64((Float64(x + 1.0) ^ -0.5) / Float64(Float64(sqrt(x) + sqrt(Float64(x + 1.0))) / (x ^ -0.5))) end
function tmp = code(x) tmp = ((x + 1.0) ^ -0.5) / ((sqrt(x) + sqrt((x + 1.0))) / (x ^ -0.5)); end
code[x_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision] / N[(N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Power[x, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(x + 1\right)}^{-0.5}}{\frac{\sqrt{x} + \sqrt{x + 1}}{{x}^{-0.5}}}
\end{array}
Initial program 70.9%
frac-sub70.9%
div-inv70.9%
*-un-lft-identity70.9%
+-commutative70.9%
*-rgt-identity70.9%
metadata-eval70.9%
frac-times70.9%
un-div-inv70.9%
pow1/271.0%
pow-flip71.2%
metadata-eval71.2%
+-commutative71.2%
Applied egg-rr71.2%
associate-*r/71.2%
Simplified71.2%
flip--71.4%
div-inv71.4%
add-sqr-sqrt62.8%
add-sqr-sqrt72.0%
associate--l+99.6%
Applied egg-rr99.6%
+-inverses99.6%
metadata-eval99.6%
*-lft-identity99.6%
Simplified99.6%
div-inv99.6%
pow1/299.6%
pow-flip99.7%
metadata-eval99.7%
metadata-eval99.7%
pow-pow97.5%
pow1/399.5%
metadata-eval99.5%
pow-flip99.3%
pow1/299.3%
*-commutative99.3%
associate-*l*99.3%
pow1/299.3%
pow-flip99.5%
metadata-eval99.5%
pow1/397.5%
pow-pow99.7%
metadata-eval99.7%
Applied egg-rr99.7%
associate-*r*99.7%
div-inv99.6%
*-commutative99.6%
clear-num99.6%
un-div-inv99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (x) :precision binary64 (let* ((t_0 (sqrt (+ x 1.0)))) (/ (pow x -0.5) (* t_0 (+ (sqrt x) t_0)))))
double code(double x) {
double t_0 = sqrt((x + 1.0));
return pow(x, -0.5) / (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 = (x ** (-0.5d0)) / (t_0 * (sqrt(x) + t_0))
end function
public static double code(double x) {
double t_0 = Math.sqrt((x + 1.0));
return Math.pow(x, -0.5) / (t_0 * (Math.sqrt(x) + t_0));
}
def code(x): t_0 = math.sqrt((x + 1.0)) return math.pow(x, -0.5) / (t_0 * (math.sqrt(x) + t_0))
function code(x) t_0 = sqrt(Float64(x + 1.0)) return Float64((x ^ -0.5) / Float64(t_0 * Float64(sqrt(x) + t_0))) end
function tmp = code(x) t_0 = sqrt((x + 1.0)); tmp = (x ^ -0.5) / (t_0 * (sqrt(x) + t_0)); end
code[x_] := Block[{t$95$0 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, N[(N[Power[x, -0.5], $MachinePrecision] / N[(t$95$0 * N[(N[Sqrt[x], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{x + 1}\\
\frac{{x}^{-0.5}}{t_0 \cdot \left(\sqrt{x} + t_0\right)}
\end{array}
\end{array}
Initial program 70.9%
frac-sub70.9%
div-inv70.9%
*-un-lft-identity70.9%
+-commutative70.9%
*-rgt-identity70.9%
metadata-eval70.9%
frac-times70.9%
un-div-inv70.9%
pow1/271.0%
pow-flip71.2%
metadata-eval71.2%
+-commutative71.2%
Applied egg-rr71.2%
associate-*r/71.2%
Simplified71.2%
flip--71.4%
div-inv71.4%
add-sqr-sqrt62.8%
add-sqr-sqrt72.0%
associate--l+99.6%
Applied egg-rr99.6%
+-inverses99.6%
metadata-eval99.6%
*-lft-identity99.6%
Simplified99.6%
metadata-eval99.6%
pow-flip99.3%
pow1/299.3%
*-commutative99.3%
*-un-lft-identity99.3%
times-frac99.3%
pow1/299.3%
pow-flip99.6%
metadata-eval99.6%
Applied egg-rr99.6%
/-rgt-identity99.6%
associate-/l/99.6%
associate-*r/99.6%
*-commutative99.6%
*-lft-identity99.6%
+-commutative99.6%
+-commutative99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x) :precision binary64 (if (<= x 5e+116) (/ 1.0 (* (+ (sqrt x) (sqrt (+ x 1.0))) (sqrt (* x (+ x 1.0))))) (* (pow x -0.5) (/ 0.5 x))))
double code(double x) {
double tmp;
if (x <= 5e+116) {
tmp = 1.0 / ((sqrt(x) + sqrt((x + 1.0))) * sqrt((x * (x + 1.0))));
} else {
tmp = pow(x, -0.5) * (0.5 / x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 5d+116) then
tmp = 1.0d0 / ((sqrt(x) + sqrt((x + 1.0d0))) * sqrt((x * (x + 1.0d0))))
else
tmp = (x ** (-0.5d0)) * (0.5d0 / x)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 5e+116) {
tmp = 1.0 / ((Math.sqrt(x) + Math.sqrt((x + 1.0))) * Math.sqrt((x * (x + 1.0))));
} else {
tmp = Math.pow(x, -0.5) * (0.5 / x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 5e+116: tmp = 1.0 / ((math.sqrt(x) + math.sqrt((x + 1.0))) * math.sqrt((x * (x + 1.0)))) else: tmp = math.pow(x, -0.5) * (0.5 / x) return tmp
function code(x) tmp = 0.0 if (x <= 5e+116) tmp = Float64(1.0 / Float64(Float64(sqrt(x) + sqrt(Float64(x + 1.0))) * sqrt(Float64(x * Float64(x + 1.0))))); else tmp = Float64((x ^ -0.5) * Float64(0.5 / x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 5e+116) tmp = 1.0 / ((sqrt(x) + sqrt((x + 1.0))) * sqrt((x * (x + 1.0)))); else tmp = (x ^ -0.5) * (0.5 / x); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 5e+116], N[(1.0 / N[(N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] * N[(0.5 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5 \cdot 10^{+116}:\\
\;\;\;\;\frac{1}{\left(\sqrt{x} + \sqrt{x + 1}\right) \cdot \sqrt{x \cdot \left(x + 1\right)}}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{0.5}{x}\\
\end{array}
\end{array}
if x < 5.00000000000000025e116Initial program 77.0%
frac-sub77.0%
div-inv77.0%
*-un-lft-identity77.0%
+-commutative77.0%
*-rgt-identity77.0%
metadata-eval77.0%
frac-times77.0%
un-div-inv77.0%
pow1/277.0%
pow-flip77.4%
metadata-eval77.4%
+-commutative77.4%
Applied egg-rr77.4%
associate-*r/77.4%
Simplified77.4%
flip--77.7%
div-inv77.7%
add-sqr-sqrt78.2%
add-sqr-sqrt78.7%
associate--l+99.7%
Applied egg-rr99.7%
+-inverses99.7%
metadata-eval99.7%
*-lft-identity99.7%
Simplified99.7%
expm1-log1p-u94.4%
expm1-udef71.2%
Applied egg-rr71.2%
expm1-def94.5%
expm1-log1p99.4%
associate-/l/99.4%
rem-exp-log92.6%
rem-exp-log99.4%
+-commutative99.4%
*-commutative99.4%
+-commutative99.4%
Simplified99.4%
if 5.00000000000000025e116 < x Initial program 59.3%
frac-sub59.3%
div-inv59.3%
*-un-lft-identity59.3%
+-commutative59.3%
*-rgt-identity59.3%
metadata-eval59.3%
frac-times59.3%
un-div-inv59.3%
pow1/259.3%
pow-flip59.3%
metadata-eval59.3%
+-commutative59.3%
Applied egg-rr59.3%
associate-*r/59.3%
Simplified59.3%
flip--59.3%
div-inv59.3%
add-sqr-sqrt33.3%
add-sqr-sqrt59.3%
associate--l+99.6%
Applied egg-rr99.6%
+-inverses99.6%
metadata-eval99.6%
*-lft-identity99.6%
Simplified99.6%
div-inv99.5%
pow1/299.5%
pow-flip99.7%
metadata-eval99.7%
metadata-eval99.7%
pow-pow96.1%
pow1/399.4%
metadata-eval99.4%
pow-flip99.3%
pow1/299.3%
*-commutative99.3%
associate-*l*99.3%
pow1/299.3%
pow-flip99.5%
metadata-eval99.5%
pow1/396.0%
pow-pow99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 99.8%
Final simplification99.5%
(FPCore (x) :precision binary64 (if (<= x 1e+72) (/ (/ 1.0 (sqrt (* x (+ x 1.0)))) (+ (sqrt x) (sqrt (+ x 1.0)))) (* (pow x -0.5) (/ 0.5 x))))
double code(double x) {
double tmp;
if (x <= 1e+72) {
tmp = (1.0 / sqrt((x * (x + 1.0)))) / (sqrt(x) + sqrt((x + 1.0)));
} else {
tmp = pow(x, -0.5) * (0.5 / x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 1d+72) then
tmp = (1.0d0 / sqrt((x * (x + 1.0d0)))) / (sqrt(x) + sqrt((x + 1.0d0)))
else
tmp = (x ** (-0.5d0)) * (0.5d0 / x)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 1e+72) {
tmp = (1.0 / Math.sqrt((x * (x + 1.0)))) / (Math.sqrt(x) + Math.sqrt((x + 1.0)));
} else {
tmp = Math.pow(x, -0.5) * (0.5 / x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 1e+72: tmp = (1.0 / math.sqrt((x * (x + 1.0)))) / (math.sqrt(x) + math.sqrt((x + 1.0))) else: tmp = math.pow(x, -0.5) * (0.5 / x) return tmp
function code(x) tmp = 0.0 if (x <= 1e+72) tmp = Float64(Float64(1.0 / sqrt(Float64(x * Float64(x + 1.0)))) / Float64(sqrt(x) + sqrt(Float64(x + 1.0)))); else tmp = Float64((x ^ -0.5) * Float64(0.5 / x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1e+72) tmp = (1.0 / sqrt((x * (x + 1.0)))) / (sqrt(x) + sqrt((x + 1.0))); else tmp = (x ^ -0.5) * (0.5 / x); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1e+72], N[(N[(1.0 / N[Sqrt[N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] * N[(0.5 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{+72}:\\
\;\;\;\;\frac{\frac{1}{\sqrt{x \cdot \left(x + 1\right)}}}{\sqrt{x} + \sqrt{x + 1}}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{0.5}{x}\\
\end{array}
\end{array}
if x < 9.99999999999999944e71Initial program 83.1%
frac-sub83.1%
div-inv83.1%
*-un-lft-identity83.1%
+-commutative83.1%
*-rgt-identity83.1%
metadata-eval83.1%
frac-times83.1%
un-div-inv83.1%
pow1/283.1%
pow-flip83.5%
metadata-eval83.5%
+-commutative83.5%
Applied egg-rr83.5%
associate-*r/83.5%
Simplified83.5%
flip--83.8%
div-inv83.8%
add-sqr-sqrt84.4%
add-sqr-sqrt84.9%
associate--l+99.7%
Applied egg-rr99.7%
+-inverses99.7%
metadata-eval99.7%
*-lft-identity99.7%
Simplified99.7%
expm1-log1p-u94.0%
expm1-udef76.8%
Applied egg-rr76.8%
expm1-def94.1%
expm1-log1p99.4%
*-commutative99.4%
+-commutative99.4%
+-commutative99.4%
Simplified99.4%
if 9.99999999999999944e71 < x Initial program 52.3%
frac-sub52.3%
div-inv52.3%
*-un-lft-identity52.3%
+-commutative52.3%
*-rgt-identity52.3%
metadata-eval52.3%
frac-times52.3%
un-div-inv52.3%
pow1/252.3%
pow-flip52.3%
metadata-eval52.3%
+-commutative52.3%
Applied egg-rr52.3%
associate-*r/52.3%
Simplified52.3%
flip--52.3%
div-inv52.3%
add-sqr-sqrt29.5%
add-sqr-sqrt52.3%
associate--l+99.5%
Applied egg-rr99.5%
+-inverses99.5%
metadata-eval99.5%
*-lft-identity99.5%
Simplified99.5%
div-inv99.5%
pow1/299.5%
pow-flip99.6%
metadata-eval99.6%
metadata-eval99.6%
pow-pow95.5%
pow1/399.3%
metadata-eval99.3%
pow-flip99.2%
pow1/299.2%
*-commutative99.2%
associate-*l*99.2%
pow1/299.2%
pow-flip99.3%
metadata-eval99.3%
pow1/395.5%
pow-pow99.6%
metadata-eval99.6%
Applied egg-rr99.6%
Taylor expanded in x around inf 99.7%
Final simplification99.5%
(FPCore (x) :precision binary64 (if (<= x 8e+153) (/ (/ 1.0 (+ (sqrt x) (sqrt (+ x 1.0)))) (sqrt (+ x (* x x)))) (* (pow x -0.5) (/ 0.5 x))))
double code(double x) {
double tmp;
if (x <= 8e+153) {
tmp = (1.0 / (sqrt(x) + sqrt((x + 1.0)))) / sqrt((x + (x * x)));
} else {
tmp = pow(x, -0.5) * (0.5 / x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 8d+153) then
tmp = (1.0d0 / (sqrt(x) + sqrt((x + 1.0d0)))) / sqrt((x + (x * x)))
else
tmp = (x ** (-0.5d0)) * (0.5d0 / x)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 8e+153) {
tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((x + 1.0)))) / Math.sqrt((x + (x * x)));
} else {
tmp = Math.pow(x, -0.5) * (0.5 / x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 8e+153: tmp = (1.0 / (math.sqrt(x) + math.sqrt((x + 1.0)))) / math.sqrt((x + (x * x))) else: tmp = math.pow(x, -0.5) * (0.5 / x) return tmp
function code(x) tmp = 0.0 if (x <= 8e+153) tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(x + 1.0)))) / sqrt(Float64(x + Float64(x * x)))); else tmp = Float64((x ^ -0.5) * Float64(0.5 / x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 8e+153) tmp = (1.0 / (sqrt(x) + sqrt((x + 1.0)))) / sqrt((x + (x * x))); else tmp = (x ^ -0.5) * (0.5 / x); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 8e+153], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(x + N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] * N[(0.5 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 8 \cdot 10^{+153}:\\
\;\;\;\;\frac{\frac{1}{\sqrt{x} + \sqrt{x + 1}}}{\sqrt{x + x \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{0.5}{x}\\
\end{array}
\end{array}
if x < 8e153Initial program 70.1%
frac-sub70.1%
clear-num70.1%
sqrt-unprod70.1%
+-commutative70.1%
*-un-lft-identity70.1%
*-rgt-identity70.1%
+-commutative70.1%
Applied egg-rr70.1%
associate-/r/70.1%
associate-*l/70.1%
*-lft-identity70.1%
distribute-rgt-in70.1%
*-lft-identity70.1%
Simplified70.1%
flip--70.7%
div-inv70.7%
add-sqr-sqrt71.1%
add-sqr-sqrt71.6%
associate--l+99.6%
Applied egg-rr99.4%
+-inverses99.6%
metadata-eval99.6%
*-lft-identity99.6%
Simplified99.4%
if 8e153 < x Initial program 73.1%
frac-sub73.1%
div-inv73.1%
*-un-lft-identity73.1%
+-commutative73.1%
*-rgt-identity73.1%
metadata-eval73.1%
frac-times73.1%
un-div-inv73.1%
pow1/273.1%
pow-flip73.1%
metadata-eval73.1%
+-commutative73.1%
Applied egg-rr73.1%
associate-*r/73.1%
Simplified73.1%
flip--73.1%
div-inv73.1%
add-sqr-sqrt40.6%
add-sqr-sqrt73.1%
associate--l+99.7%
Applied egg-rr99.7%
+-inverses99.7%
metadata-eval99.7%
*-lft-identity99.7%
Simplified99.7%
div-inv99.7%
pow1/299.7%
pow-flip99.9%
metadata-eval99.9%
metadata-eval99.9%
pow-pow97.4%
pow1/399.6%
metadata-eval99.6%
pow-flip99.5%
pow1/299.5%
*-commutative99.5%
associate-*l*99.5%
pow1/299.5%
pow-flip99.6%
metadata-eval99.6%
pow1/397.4%
pow-pow99.9%
metadata-eval99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 99.9%
Final simplification99.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (sqrt (+ x 1.0))))
(if (<= x 44000000.0)
(* (pow x -0.5) (- 1.0 (/ (sqrt x) t_0)))
(/ (/ 0.5 x) t_0))))
double code(double x) {
double t_0 = sqrt((x + 1.0));
double tmp;
if (x <= 44000000.0) {
tmp = pow(x, -0.5) * (1.0 - (sqrt(x) / t_0));
} else {
tmp = (0.5 / x) / t_0;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((x + 1.0d0))
if (x <= 44000000.0d0) then
tmp = (x ** (-0.5d0)) * (1.0d0 - (sqrt(x) / t_0))
else
tmp = (0.5d0 / x) / t_0
end if
code = tmp
end function
public static double code(double x) {
double t_0 = Math.sqrt((x + 1.0));
double tmp;
if (x <= 44000000.0) {
tmp = Math.pow(x, -0.5) * (1.0 - (Math.sqrt(x) / t_0));
} else {
tmp = (0.5 / x) / t_0;
}
return tmp;
}
def code(x): t_0 = math.sqrt((x + 1.0)) tmp = 0 if x <= 44000000.0: tmp = math.pow(x, -0.5) * (1.0 - (math.sqrt(x) / t_0)) else: tmp = (0.5 / x) / t_0 return tmp
function code(x) t_0 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (x <= 44000000.0) tmp = Float64((x ^ -0.5) * Float64(1.0 - Float64(sqrt(x) / t_0))); else tmp = Float64(Float64(0.5 / x) / t_0); end return tmp end
function tmp_2 = code(x) t_0 = sqrt((x + 1.0)); tmp = 0.0; if (x <= 44000000.0) tmp = (x ^ -0.5) * (1.0 - (sqrt(x) / t_0)); else tmp = (0.5 / x) / t_0; end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 44000000.0], N[(N[Power[x, -0.5], $MachinePrecision] * N[(1.0 - N[(N[Sqrt[x], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / x), $MachinePrecision] / t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{x + 1}\\
\mathbf{if}\;x \leq 44000000:\\
\;\;\;\;{x}^{-0.5} \cdot \left(1 - \frac{\sqrt{x}}{t_0}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.5}{x}}{t_0}\\
\end{array}
\end{array}
if x < 4.4e7Initial program 98.9%
frac-sub99.0%
div-inv99.0%
*-un-lft-identity99.0%
+-commutative99.0%
*-rgt-identity99.0%
metadata-eval99.0%
frac-times99.0%
un-div-inv99.0%
pow1/299.0%
pow-flip99.4%
metadata-eval99.4%
+-commutative99.4%
Applied egg-rr99.4%
associate-*r/99.5%
*-rgt-identity99.5%
times-frac99.4%
div-sub99.4%
*-inverses99.4%
/-rgt-identity99.4%
Simplified99.4%
if 4.4e7 < x Initial program 42.9%
frac-sub42.9%
div-inv42.9%
*-un-lft-identity42.9%
+-commutative42.9%
*-rgt-identity42.9%
metadata-eval42.9%
frac-times42.9%
un-div-inv42.9%
pow1/242.9%
pow-flip42.9%
metadata-eval42.9%
+-commutative42.9%
Applied egg-rr42.9%
associate-*r/42.9%
Simplified42.9%
flip--43.3%
div-inv43.3%
add-sqr-sqrt26.1%
add-sqr-sqrt44.2%
associate--l+99.4%
Applied egg-rr99.4%
+-inverses99.4%
metadata-eval99.4%
*-lft-identity99.4%
Simplified99.4%
Taylor expanded in x around inf 99.2%
Final simplification99.3%
(FPCore (x) :precision binary64 (if (<= x 0.72) (+ (+ (pow x -0.5) (* x 0.5)) -1.0) (/ (/ 0.5 x) (sqrt (+ x 1.0)))))
double code(double x) {
double tmp;
if (x <= 0.72) {
tmp = (pow(x, -0.5) + (x * 0.5)) + -1.0;
} else {
tmp = (0.5 / x) / sqrt((x + 1.0));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.72d0) then
tmp = ((x ** (-0.5d0)) + (x * 0.5d0)) + (-1.0d0)
else
tmp = (0.5d0 / x) / sqrt((x + 1.0d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.72) {
tmp = (Math.pow(x, -0.5) + (x * 0.5)) + -1.0;
} else {
tmp = (0.5 / x) / Math.sqrt((x + 1.0));
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.72: tmp = (math.pow(x, -0.5) + (x * 0.5)) + -1.0 else: tmp = (0.5 / x) / math.sqrt((x + 1.0)) return tmp
function code(x) tmp = 0.0 if (x <= 0.72) tmp = Float64(Float64((x ^ -0.5) + Float64(x * 0.5)) + -1.0); else tmp = Float64(Float64(0.5 / x) / sqrt(Float64(x + 1.0))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.72) tmp = ((x ^ -0.5) + (x * 0.5)) + -1.0; else tmp = (0.5 / x) / sqrt((x + 1.0)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.72], N[(N[(N[Power[x, -0.5], $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(0.5 / x), $MachinePrecision] / N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.72:\\
\;\;\;\;\left({x}^{-0.5} + x \cdot 0.5\right) + -1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.5}{x}}{\sqrt{x + 1}}\\
\end{array}
\end{array}
if x < 0.71999999999999997Initial program 99.5%
inv-pow99.5%
pow1/299.5%
pow-pow100.0%
add-exp-log92.8%
pow-exp92.8%
metadata-eval92.8%
Applied egg-rr92.8%
Taylor expanded in x around 0 99.5%
if 0.71999999999999997 < x Initial program 44.0%
frac-sub44.1%
div-inv44.1%
*-un-lft-identity44.1%
+-commutative44.1%
*-rgt-identity44.1%
metadata-eval44.1%
frac-times44.1%
un-div-inv44.1%
pow1/244.1%
pow-flip44.1%
metadata-eval44.1%
+-commutative44.1%
Applied egg-rr44.1%
associate-*r/44.1%
Simplified44.1%
flip--44.6%
div-inv44.6%
add-sqr-sqrt27.9%
add-sqr-sqrt45.9%
associate--l+99.4%
Applied egg-rr99.4%
+-inverses99.4%
metadata-eval99.4%
*-lft-identity99.4%
Simplified99.4%
Taylor expanded in x around inf 97.4%
Final simplification98.4%
(FPCore (x) :precision binary64 (if (<= x 0.72) (+ (pow x -0.5) (- -1.0 (* x -0.5))) (/ (/ 0.5 x) (sqrt (+ x 1.0)))))
double code(double x) {
double tmp;
if (x <= 0.72) {
tmp = pow(x, -0.5) + (-1.0 - (x * -0.5));
} else {
tmp = (0.5 / x) / sqrt((x + 1.0));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.72d0) then
tmp = (x ** (-0.5d0)) + ((-1.0d0) - (x * (-0.5d0)))
else
tmp = (0.5d0 / x) / sqrt((x + 1.0d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.72) {
tmp = Math.pow(x, -0.5) + (-1.0 - (x * -0.5));
} else {
tmp = (0.5 / x) / Math.sqrt((x + 1.0));
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.72: tmp = math.pow(x, -0.5) + (-1.0 - (x * -0.5)) else: tmp = (0.5 / x) / math.sqrt((x + 1.0)) return tmp
function code(x) tmp = 0.0 if (x <= 0.72) tmp = Float64((x ^ -0.5) + Float64(-1.0 - Float64(x * -0.5))); else tmp = Float64(Float64(0.5 / x) / sqrt(Float64(x + 1.0))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.72) tmp = (x ^ -0.5) + (-1.0 - (x * -0.5)); else tmp = (0.5 / x) / sqrt((x + 1.0)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.72], N[(N[Power[x, -0.5], $MachinePrecision] + N[(-1.0 - N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / x), $MachinePrecision] / N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.72:\\
\;\;\;\;{x}^{-0.5} + \left(-1 - x \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.5}{x}}{\sqrt{x + 1}}\\
\end{array}
\end{array}
if x < 0.71999999999999997Initial program 99.5%
Taylor expanded in x around 0 99.1%
add-log-exp4.8%
*-un-lft-identity4.8%
log-prod4.8%
metadata-eval4.8%
add-log-exp99.1%
pow1/299.1%
pow-flip99.5%
metadata-eval99.5%
Applied egg-rr99.5%
+-lft-identity99.5%
Simplified99.5%
if 0.71999999999999997 < x Initial program 44.0%
frac-sub44.1%
div-inv44.1%
*-un-lft-identity44.1%
+-commutative44.1%
*-rgt-identity44.1%
metadata-eval44.1%
frac-times44.1%
un-div-inv44.1%
pow1/244.1%
pow-flip44.1%
metadata-eval44.1%
+-commutative44.1%
Applied egg-rr44.1%
associate-*r/44.1%
Simplified44.1%
flip--44.6%
div-inv44.6%
add-sqr-sqrt27.9%
add-sqr-sqrt45.9%
associate--l+99.4%
Applied egg-rr99.4%
+-inverses99.4%
metadata-eval99.4%
*-lft-identity99.4%
Simplified99.4%
Taylor expanded in x around inf 97.4%
Final simplification98.4%
(FPCore (x) :precision binary64 (if (<= x 0.48) (+ (pow x -0.5) -1.0) (/ (/ 0.5 x) (sqrt (+ x 1.0)))))
double code(double x) {
double tmp;
if (x <= 0.48) {
tmp = pow(x, -0.5) + -1.0;
} else {
tmp = (0.5 / x) / sqrt((x + 1.0));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.48d0) then
tmp = (x ** (-0.5d0)) + (-1.0d0)
else
tmp = (0.5d0 / x) / sqrt((x + 1.0d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.48) {
tmp = Math.pow(x, -0.5) + -1.0;
} else {
tmp = (0.5 / x) / Math.sqrt((x + 1.0));
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.48: tmp = math.pow(x, -0.5) + -1.0 else: tmp = (0.5 / x) / math.sqrt((x + 1.0)) return tmp
function code(x) tmp = 0.0 if (x <= 0.48) tmp = Float64((x ^ -0.5) + -1.0); else tmp = Float64(Float64(0.5 / x) / sqrt(Float64(x + 1.0))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.48) tmp = (x ^ -0.5) + -1.0; else tmp = (0.5 / x) / sqrt((x + 1.0)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.48], N[(N[Power[x, -0.5], $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(0.5 / x), $MachinePrecision] / N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.48:\\
\;\;\;\;{x}^{-0.5} + -1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.5}{x}}{\sqrt{x + 1}}\\
\end{array}
\end{array}
if x < 0.47999999999999998Initial program 99.5%
inv-pow99.5%
pow1/299.5%
pow-pow100.0%
add-exp-log92.8%
pow-exp92.8%
metadata-eval92.8%
Applied egg-rr92.8%
Taylor expanded in x around 0 98.2%
if 0.47999999999999998 < x Initial program 44.0%
frac-sub44.1%
div-inv44.1%
*-un-lft-identity44.1%
+-commutative44.1%
*-rgt-identity44.1%
metadata-eval44.1%
frac-times44.1%
un-div-inv44.1%
pow1/244.1%
pow-flip44.1%
metadata-eval44.1%
+-commutative44.1%
Applied egg-rr44.1%
associate-*r/44.1%
Simplified44.1%
flip--44.6%
div-inv44.6%
add-sqr-sqrt27.9%
add-sqr-sqrt45.9%
associate--l+99.4%
Applied egg-rr99.4%
+-inverses99.4%
metadata-eval99.4%
*-lft-identity99.4%
Simplified99.4%
Taylor expanded in x around inf 97.4%
Final simplification97.8%
(FPCore (x) :precision binary64 (if (<= x 0.7) (+ (pow x -0.5) -1.0) (* (pow x -0.5) (/ 0.5 x))))
double code(double x) {
double tmp;
if (x <= 0.7) {
tmp = pow(x, -0.5) + -1.0;
} else {
tmp = pow(x, -0.5) * (0.5 / x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.7d0) then
tmp = (x ** (-0.5d0)) + (-1.0d0)
else
tmp = (x ** (-0.5d0)) * (0.5d0 / x)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.7) {
tmp = Math.pow(x, -0.5) + -1.0;
} else {
tmp = Math.pow(x, -0.5) * (0.5 / x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.7: tmp = math.pow(x, -0.5) + -1.0 else: tmp = math.pow(x, -0.5) * (0.5 / x) return tmp
function code(x) tmp = 0.0 if (x <= 0.7) tmp = Float64((x ^ -0.5) + -1.0); else tmp = Float64((x ^ -0.5) * Float64(0.5 / x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.7) tmp = (x ^ -0.5) + -1.0; else tmp = (x ^ -0.5) * (0.5 / x); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.7], N[(N[Power[x, -0.5], $MachinePrecision] + -1.0), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] * N[(0.5 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.7:\\
\;\;\;\;{x}^{-0.5} + -1\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{0.5}{x}\\
\end{array}
\end{array}
if x < 0.69999999999999996Initial program 99.5%
inv-pow99.5%
pow1/299.5%
pow-pow100.0%
add-exp-log92.8%
pow-exp92.8%
metadata-eval92.8%
Applied egg-rr92.8%
Taylor expanded in x around 0 98.2%
if 0.69999999999999996 < x Initial program 44.0%
frac-sub44.1%
div-inv44.1%
*-un-lft-identity44.1%
+-commutative44.1%
*-rgt-identity44.1%
metadata-eval44.1%
frac-times44.1%
un-div-inv44.1%
pow1/244.1%
pow-flip44.1%
metadata-eval44.1%
+-commutative44.1%
Applied egg-rr44.1%
associate-*r/44.1%
Simplified44.1%
flip--44.6%
div-inv44.6%
add-sqr-sqrt27.9%
add-sqr-sqrt45.9%
associate--l+99.4%
Applied egg-rr99.4%
+-inverses99.4%
metadata-eval99.4%
*-lft-identity99.4%
Simplified99.4%
div-inv99.3%
pow1/299.3%
pow-flip99.4%
metadata-eval99.4%
metadata-eval99.4%
pow-pow95.2%
pow1/399.2%
metadata-eval99.2%
pow-flip99.1%
pow1/299.1%
*-commutative99.1%
associate-*l*99.0%
pow1/299.0%
pow-flip99.2%
metadata-eval99.2%
pow1/395.2%
pow-pow99.4%
metadata-eval99.4%
Applied egg-rr99.4%
Taylor expanded in x around inf 97.3%
Final simplification97.7%
(FPCore (x) :precision binary64 (if (<= x 0.6) (+ (pow x -0.5) -1.0) (- (/ 1.0 x) (/ 0.5 (* x x)))))
double code(double x) {
double tmp;
if (x <= 0.6) {
tmp = pow(x, -0.5) + -1.0;
} else {
tmp = (1.0 / x) - (0.5 / (x * x));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.6d0) then
tmp = (x ** (-0.5d0)) + (-1.0d0)
else
tmp = (1.0d0 / x) - (0.5d0 / (x * x))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.6) {
tmp = Math.pow(x, -0.5) + -1.0;
} else {
tmp = (1.0 / x) - (0.5 / (x * x));
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.6: tmp = math.pow(x, -0.5) + -1.0 else: tmp = (1.0 / x) - (0.5 / (x * x)) return tmp
function code(x) tmp = 0.0 if (x <= 0.6) tmp = Float64((x ^ -0.5) + -1.0); else tmp = Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.6) tmp = (x ^ -0.5) + -1.0; else tmp = (1.0 / x) - (0.5 / (x * x)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.6], N[(N[Power[x, -0.5], $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.6:\\
\;\;\;\;{x}^{-0.5} + -1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x} - \frac{0.5}{x \cdot x}\\
\end{array}
\end{array}
if x < 0.599999999999999978Initial program 99.5%
inv-pow99.5%
pow1/299.5%
pow-pow100.0%
add-exp-log92.8%
pow-exp92.8%
metadata-eval92.8%
Applied egg-rr92.8%
Taylor expanded in x around 0 98.2%
if 0.599999999999999978 < x Initial program 44.0%
frac-sub44.1%
div-inv44.1%
*-un-lft-identity44.1%
+-commutative44.1%
*-rgt-identity44.1%
metadata-eval44.1%
frac-times44.1%
un-div-inv44.1%
pow1/244.1%
pow-flip44.1%
metadata-eval44.1%
+-commutative44.1%
Applied egg-rr44.1%
associate-*r/44.1%
Simplified44.1%
Taylor expanded in x around 0 7.9%
Taylor expanded in x around inf 7.9%
associate-*r/7.9%
metadata-eval7.9%
unpow27.9%
Simplified7.9%
Final simplification51.6%
(FPCore (x) :precision binary64 (pow x -0.5))
double code(double x) {
return pow(x, -0.5);
}
real(8) function code(x)
real(8), intent (in) :: x
code = x ** (-0.5d0)
end function
public static double code(double x) {
return Math.pow(x, -0.5);
}
def code(x): return math.pow(x, -0.5)
function code(x) return x ^ -0.5 end
function tmp = code(x) tmp = x ^ -0.5; end
code[x_] := N[Power[x, -0.5], $MachinePrecision]
\begin{array}{l}
\\
{x}^{-0.5}
\end{array}
Initial program 70.9%
inv-pow70.9%
pow1/270.9%
pow-pow65.8%
add-exp-log48.8%
pow-exp48.8%
metadata-eval48.8%
Applied egg-rr48.8%
Taylor expanded in x around inf 48.6%
unpow-148.6%
metadata-eval48.6%
pow-sqr48.6%
rem-sqrt-square48.6%
unpow148.6%
sqr-pow48.3%
fabs-sqr48.3%
sqr-pow48.6%
unpow148.6%
Simplified48.6%
Final simplification48.6%
(FPCore (x) :precision binary64 (/ 1.0 x))
double code(double x) {
return 1.0 / x;
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0 / x
end function
public static double code(double x) {
return 1.0 / x;
}
def code(x): return 1.0 / x
function code(x) return Float64(1.0 / x) end
function tmp = code(x) tmp = 1.0 / x; end
code[x_] := N[(1.0 / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{x}
\end{array}
Initial program 70.9%
frac-sub70.9%
div-inv70.9%
*-un-lft-identity70.9%
+-commutative70.9%
*-rgt-identity70.9%
metadata-eval70.9%
frac-times70.9%
un-div-inv70.9%
pow1/271.0%
pow-flip71.2%
metadata-eval71.2%
+-commutative71.2%
Applied egg-rr71.2%
associate-*r/71.2%
Simplified71.2%
Taylor expanded in x around 0 49.8%
Taylor expanded in x around inf 7.6%
Final simplification7.6%
(FPCore (x) :precision binary64 -1.0)
double code(double x) {
return -1.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = -1.0d0
end function
public static double code(double x) {
return -1.0;
}
def code(x): return -1.0
function code(x) return -1.0 end
function tmp = code(x) tmp = -1.0; end
code[x_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 70.9%
add-cube-cbrt52.8%
associate-*l*52.8%
frac-2neg52.8%
metadata-eval52.8%
div-inv52.8%
metadata-eval52.8%
distribute-neg-frac52.8%
metadata-eval52.8%
frac-2neg52.8%
prod-diff51.2%
Applied egg-rr51.6%
fma-udef58.1%
distribute-rgt-neg-in58.1%
metadata-eval58.1%
*-rgt-identity58.1%
*-commutative58.1%
associate-+l+58.1%
*-commutative58.1%
fma-udef58.1%
Simplified51.6%
Taylor expanded in x around 0 2.0%
Final simplification2.0%
(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 2023217
(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)))))