
(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 15 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 (/ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (hypot x (sqrt x))))
double code(double x) {
return (1.0 / (sqrt(x) + sqrt((1.0 + x)))) / hypot(x, sqrt(x));
}
public static double code(double x) {
return (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) / Math.hypot(x, Math.sqrt(x));
}
def code(x): return (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) / math.hypot(x, math.sqrt(x))
function code(x) return Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) / hypot(x, sqrt(x))) end
function tmp = code(x) tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) / hypot(x, sqrt(x)); end
code[x_] := N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[x ^ 2 + N[Sqrt[x], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\mathsf{hypot}\left(x, \sqrt{x}\right)}
\end{array}
Initial program 67.5%
frac-sub67.5%
clear-num67.5%
sqrt-unprod67.5%
+-commutative67.5%
*-un-lft-identity67.5%
*-rgt-identity67.5%
+-commutative67.5%
Applied egg-rr67.5%
associate-/r/67.5%
associate-*l/67.5%
*-lft-identity67.5%
unpow167.5%
sqr-pow67.6%
metadata-eval67.6%
exp-to-pow67.5%
metadata-eval67.5%
exp-to-pow67.5%
hypot-1-def67.5%
exp-to-pow67.6%
unpow1/267.6%
+-commutative67.6%
distribute-lft-in67.6%
*-rgt-identity67.6%
unpow167.6%
sqr-pow67.6%
metadata-eval67.6%
exp-to-pow65.0%
metadata-eval65.0%
Simplified67.6%
flip--68.1%
div-inv68.1%
hypot-1-def68.1%
add-sqr-sqrt68.0%
hypot-1-def68.0%
add-sqr-sqrt68.0%
add-sqr-sqrt59.5%
add-sqr-sqrt68.2%
hypot-1-def68.2%
add-sqr-sqrt68.2%
Applied egg-rr68.2%
*-rgt-identity68.2%
associate-*r/68.2%
*-rgt-identity68.2%
*-rgt-identity68.2%
associate--l+99.7%
+-inverses99.7%
metadata-eval99.7%
+-commutative99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x) :precision binary64 (if (<= (+ (/ 1.0 (sqrt x)) (/ -1.0 (sqrt (+ 1.0 x)))) 2e-16) (/ (/ 1.0 (* x x)) (* (sqrt (/ 1.0 x)) 2.0)) (- (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-16) {
tmp = (1.0 / (x * x)) / (sqrt((1.0 / x)) * 2.0);
} 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-16) then
tmp = (1.0d0 / (x * x)) / (sqrt((1.0d0 / x)) * 2.0d0)
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-16) {
tmp = (1.0 / (x * x)) / (Math.sqrt((1.0 / x)) * 2.0);
} 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-16: tmp = (1.0 / (x * x)) / (math.sqrt((1.0 / x)) * 2.0) 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-16) tmp = Float64(Float64(1.0 / Float64(x * x)) / Float64(sqrt(Float64(1.0 / x)) * 2.0)); 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-16) tmp = (1.0 / (x * x)) / (sqrt((1.0 / x)) * 2.0); 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-16], N[(N[(1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] * 2.0), $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^{-16}:\\
\;\;\;\;\frac{\frac{1}{x \cdot x}}{\sqrt{\frac{1}{x}} \cdot 2}\\
\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-16Initial program 37.9%
flip--37.9%
frac-times22.1%
metadata-eval22.1%
add-sqr-sqrt22.4%
frac-times24.4%
metadata-eval24.4%
add-sqr-sqrt37.9%
+-commutative37.9%
pow1/237.9%
pow-flip37.9%
metadata-eval37.9%
inv-pow37.9%
sqrt-pow237.9%
+-commutative37.9%
metadata-eval37.9%
Applied egg-rr37.9%
Taylor expanded in x around inf 81.0%
unpow281.0%
Simplified81.0%
Taylor expanded in x around inf 81.0%
if 2e-16 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) Initial program 99.1%
*-un-lft-identity99.1%
clear-num99.1%
associate-/r/99.1%
prod-diff99.1%
*-un-lft-identity99.1%
fma-neg99.1%
*-un-lft-identity99.1%
inv-pow99.1%
sqrt-pow299.5%
metadata-eval99.5%
pow1/299.5%
pow-flip99.5%
+-commutative99.5%
metadata-eval99.5%
Applied egg-rr99.5%
fma-udef99.5%
neg-mul-199.5%
rem-log-exp99.2%
log-rec99.2%
+-commutative99.2%
log-rec99.2%
rem-log-exp99.5%
sub-neg99.5%
+-inverses99.5%
+-rgt-identity99.5%
Simplified99.5%
Final simplification90.0%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ (pow x -0.5) (pow (+ 1.0 x) -0.5))))
(if (<= x 4e+144)
(/ (+ 1.0 (- x x)) (* (+ x (* x x)) t_0))
(* (/ 1.0 x) (/ (/ 1.0 x) t_0)))))
double code(double x) {
double t_0 = pow(x, -0.5) + pow((1.0 + x), -0.5);
double tmp;
if (x <= 4e+144) {
tmp = (1.0 + (x - x)) / ((x + (x * x)) * t_0);
} else {
tmp = (1.0 / x) * ((1.0 / x) / t_0);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = (x ** (-0.5d0)) + ((1.0d0 + x) ** (-0.5d0))
if (x <= 4d+144) then
tmp = (1.0d0 + (x - x)) / ((x + (x * x)) * t_0)
else
tmp = (1.0d0 / x) * ((1.0d0 / x) / t_0)
end if
code = tmp
end function
public static double code(double x) {
double t_0 = Math.pow(x, -0.5) + Math.pow((1.0 + x), -0.5);
double tmp;
if (x <= 4e+144) {
tmp = (1.0 + (x - x)) / ((x + (x * x)) * t_0);
} else {
tmp = (1.0 / x) * ((1.0 / x) / t_0);
}
return tmp;
}
def code(x): t_0 = math.pow(x, -0.5) + math.pow((1.0 + x), -0.5) tmp = 0 if x <= 4e+144: tmp = (1.0 + (x - x)) / ((x + (x * x)) * t_0) else: tmp = (1.0 / x) * ((1.0 / x) / t_0) return tmp
function code(x) t_0 = Float64((x ^ -0.5) + (Float64(1.0 + x) ^ -0.5)) tmp = 0.0 if (x <= 4e+144) tmp = Float64(Float64(1.0 + Float64(x - x)) / Float64(Float64(x + Float64(x * x)) * t_0)); else tmp = Float64(Float64(1.0 / x) * Float64(Float64(1.0 / x) / t_0)); end return tmp end
function tmp_2 = code(x) t_0 = (x ^ -0.5) + ((1.0 + x) ^ -0.5); tmp = 0.0; if (x <= 4e+144) tmp = (1.0 + (x - x)) / ((x + (x * x)) * t_0); else tmp = (1.0 / x) * ((1.0 / x) / t_0); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(N[Power[x, -0.5], $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 4e+144], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[(x + N[(x * x), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] * N[(N[(1.0 / x), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\\
\mathbf{if}\;x \leq 4 \cdot 10^{+144}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\left(x + x \cdot x\right) \cdot t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{\frac{1}{x}}{t_0}\\
\end{array}
\end{array}
if x < 4.00000000000000009e144Initial program 68.9%
*-un-lft-identity68.9%
clear-num68.9%
associate-/r/68.9%
prod-diff68.9%
*-un-lft-identity68.9%
fma-neg68.9%
*-un-lft-identity68.9%
inv-pow68.9%
sqrt-pow269.2%
metadata-eval69.2%
pow1/269.2%
pow-flip69.2%
+-commutative69.2%
metadata-eval69.2%
Applied egg-rr69.2%
fma-udef69.2%
neg-mul-169.2%
rem-log-exp69.3%
log-rec69.3%
+-commutative69.3%
log-rec69.3%
rem-log-exp69.2%
sub-neg69.2%
+-inverses69.2%
+-rgt-identity69.2%
Simplified69.2%
sqr-pow68.7%
metadata-eval68.7%
metadata-eval68.7%
Applied egg-rr68.7%
flip--68.6%
pow-prod-up68.3%
metadata-eval68.3%
div-inv68.3%
Applied egg-rr69.8%
*-rgt-identity69.8%
*-rgt-identity69.8%
associate--l+99.3%
distribute-lft-in99.3%
*-rgt-identity99.3%
+-commutative99.3%
Simplified99.3%
if 4.00000000000000009e144 < x Initial program 64.0%
flip--64.0%
frac-times35.5%
metadata-eval35.5%
add-sqr-sqrt36.0%
frac-times39.3%
metadata-eval39.3%
add-sqr-sqrt64.0%
+-commutative64.0%
pow1/264.0%
pow-flip64.0%
metadata-eval64.0%
inv-pow64.0%
sqrt-pow264.0%
+-commutative64.0%
metadata-eval64.0%
Applied egg-rr64.0%
Taylor expanded in x around inf 66.5%
unpow266.5%
Simplified66.5%
metadata-eval66.5%
frac-times69.7%
*-un-lft-identity69.7%
times-frac99.7%
Applied egg-rr99.7%
Final simplification99.4%
(FPCore (x)
:precision binary64
(let* ((t_0 (pow (+ 1.0 x) -0.5)))
(if (<= x 160000000.0)
(- (pow x -0.5) t_0)
(/ (* (/ 1.0 x) (/ 1.0 x)) (+ (pow x -0.5) t_0)))))
double code(double x) {
double t_0 = pow((1.0 + x), -0.5);
double tmp;
if (x <= 160000000.0) {
tmp = pow(x, -0.5) - t_0;
} else {
tmp = ((1.0 / x) * (1.0 / x)) / (pow(x, -0.5) + t_0);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = (1.0d0 + x) ** (-0.5d0)
if (x <= 160000000.0d0) then
tmp = (x ** (-0.5d0)) - t_0
else
tmp = ((1.0d0 / x) * (1.0d0 / x)) / ((x ** (-0.5d0)) + t_0)
end if
code = tmp
end function
public static double code(double x) {
double t_0 = Math.pow((1.0 + x), -0.5);
double tmp;
if (x <= 160000000.0) {
tmp = Math.pow(x, -0.5) - t_0;
} else {
tmp = ((1.0 / x) * (1.0 / x)) / (Math.pow(x, -0.5) + t_0);
}
return tmp;
}
def code(x): t_0 = math.pow((1.0 + x), -0.5) tmp = 0 if x <= 160000000.0: tmp = math.pow(x, -0.5) - t_0 else: tmp = ((1.0 / x) * (1.0 / x)) / (math.pow(x, -0.5) + t_0) return tmp
function code(x) t_0 = Float64(1.0 + x) ^ -0.5 tmp = 0.0 if (x <= 160000000.0) tmp = Float64((x ^ -0.5) - t_0); else tmp = Float64(Float64(Float64(1.0 / x) * Float64(1.0 / x)) / Float64((x ^ -0.5) + t_0)); end return tmp end
function tmp_2 = code(x) t_0 = (1.0 + x) ^ -0.5; tmp = 0.0; if (x <= 160000000.0) tmp = (x ^ -0.5) - t_0; else tmp = ((1.0 / x) * (1.0 / x)) / ((x ^ -0.5) + t_0); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[x, 160000000.0], N[(N[Power[x, -0.5], $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] / N[(N[Power[x, -0.5], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + x\right)}^{-0.5}\\
\mathbf{if}\;x \leq 160000000:\\
\;\;\;\;{x}^{-0.5} - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x} \cdot \frac{1}{x}}{{x}^{-0.5} + t_0}\\
\end{array}
\end{array}
if x < 1.6e8Initial program 99.1%
*-un-lft-identity99.1%
clear-num99.1%
associate-/r/99.1%
prod-diff99.1%
*-un-lft-identity99.1%
fma-neg99.1%
*-un-lft-identity99.1%
inv-pow99.1%
sqrt-pow299.5%
metadata-eval99.5%
pow1/299.5%
pow-flip99.5%
+-commutative99.5%
metadata-eval99.5%
Applied egg-rr99.5%
fma-udef99.5%
neg-mul-199.5%
rem-log-exp99.2%
log-rec99.2%
+-commutative99.2%
log-rec99.2%
rem-log-exp99.5%
sub-neg99.5%
+-inverses99.5%
+-rgt-identity99.5%
Simplified99.5%
if 1.6e8 < x Initial program 37.9%
flip--37.9%
frac-times22.1%
metadata-eval22.1%
add-sqr-sqrt22.4%
frac-times24.4%
metadata-eval24.4%
add-sqr-sqrt37.9%
+-commutative37.9%
pow1/237.9%
pow-flip37.9%
metadata-eval37.9%
inv-pow37.9%
sqrt-pow237.9%
+-commutative37.9%
metadata-eval37.9%
Applied egg-rr37.9%
Taylor expanded in x around inf 81.0%
unpow281.0%
Simplified81.0%
metadata-eval81.0%
frac-times82.5%
Applied egg-rr82.5%
Final simplification90.7%
(FPCore (x)
:precision binary64
(let* ((t_0 (pow (+ 1.0 x) -0.5)))
(if (<= x 160000000.0)
(- (pow x -0.5) t_0)
(* (/ 1.0 x) (/ (/ 1.0 x) (+ (pow x -0.5) t_0))))))
double code(double x) {
double t_0 = pow((1.0 + x), -0.5);
double tmp;
if (x <= 160000000.0) {
tmp = pow(x, -0.5) - t_0;
} else {
tmp = (1.0 / x) * ((1.0 / x) / (pow(x, -0.5) + t_0));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = (1.0d0 + x) ** (-0.5d0)
if (x <= 160000000.0d0) then
tmp = (x ** (-0.5d0)) - t_0
else
tmp = (1.0d0 / x) * ((1.0d0 / x) / ((x ** (-0.5d0)) + t_0))
end if
code = tmp
end function
public static double code(double x) {
double t_0 = Math.pow((1.0 + x), -0.5);
double tmp;
if (x <= 160000000.0) {
tmp = Math.pow(x, -0.5) - t_0;
} else {
tmp = (1.0 / x) * ((1.0 / x) / (Math.pow(x, -0.5) + t_0));
}
return tmp;
}
def code(x): t_0 = math.pow((1.0 + x), -0.5) tmp = 0 if x <= 160000000.0: tmp = math.pow(x, -0.5) - t_0 else: tmp = (1.0 / x) * ((1.0 / x) / (math.pow(x, -0.5) + t_0)) return tmp
function code(x) t_0 = Float64(1.0 + x) ^ -0.5 tmp = 0.0 if (x <= 160000000.0) tmp = Float64((x ^ -0.5) - t_0); else tmp = Float64(Float64(1.0 / x) * Float64(Float64(1.0 / x) / Float64((x ^ -0.5) + t_0))); end return tmp end
function tmp_2 = code(x) t_0 = (1.0 + x) ^ -0.5; tmp = 0.0; if (x <= 160000000.0) tmp = (x ^ -0.5) - t_0; else tmp = (1.0 / x) * ((1.0 / x) / ((x ^ -0.5) + t_0)); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[x, 160000000.0], N[(N[Power[x, -0.5], $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] * N[(N[(1.0 / x), $MachinePrecision] / N[(N[Power[x, -0.5], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + x\right)}^{-0.5}\\
\mathbf{if}\;x \leq 160000000:\\
\;\;\;\;{x}^{-0.5} - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{\frac{1}{x}}{{x}^{-0.5} + t_0}\\
\end{array}
\end{array}
if x < 1.6e8Initial program 99.1%
*-un-lft-identity99.1%
clear-num99.1%
associate-/r/99.1%
prod-diff99.1%
*-un-lft-identity99.1%
fma-neg99.1%
*-un-lft-identity99.1%
inv-pow99.1%
sqrt-pow299.5%
metadata-eval99.5%
pow1/299.5%
pow-flip99.5%
+-commutative99.5%
metadata-eval99.5%
Applied egg-rr99.5%
fma-udef99.5%
neg-mul-199.5%
rem-log-exp99.2%
log-rec99.2%
+-commutative99.2%
log-rec99.2%
rem-log-exp99.5%
sub-neg99.5%
+-inverses99.5%
+-rgt-identity99.5%
Simplified99.5%
if 1.6e8 < x Initial program 37.9%
flip--37.9%
frac-times22.1%
metadata-eval22.1%
add-sqr-sqrt22.4%
frac-times24.4%
metadata-eval24.4%
add-sqr-sqrt37.9%
+-commutative37.9%
pow1/237.9%
pow-flip37.9%
metadata-eval37.9%
inv-pow37.9%
sqrt-pow237.9%
+-commutative37.9%
metadata-eval37.9%
Applied egg-rr37.9%
Taylor expanded in x around inf 81.0%
unpow281.0%
Simplified81.0%
metadata-eval81.0%
frac-times82.5%
*-un-lft-identity82.5%
times-frac99.0%
Applied egg-rr99.0%
Final simplification99.3%
(FPCore (x) :precision binary64 (if (<= x 58000000.0) (- (pow x -0.5) (pow (+ 1.0 x) -0.5)) (/ (/ 1.0 (* x x)) (+ (pow x -0.5) (sqrt (/ 1.0 x))))))
double code(double x) {
double tmp;
if (x <= 58000000.0) {
tmp = pow(x, -0.5) - pow((1.0 + x), -0.5);
} else {
tmp = (1.0 / (x * x)) / (pow(x, -0.5) + sqrt((1.0 / x)));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 58000000.0d0) then
tmp = (x ** (-0.5d0)) - ((1.0d0 + x) ** (-0.5d0))
else
tmp = (1.0d0 / (x * x)) / ((x ** (-0.5d0)) + sqrt((1.0d0 / x)))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 58000000.0) {
tmp = Math.pow(x, -0.5) - Math.pow((1.0 + x), -0.5);
} else {
tmp = (1.0 / (x * x)) / (Math.pow(x, -0.5) + Math.sqrt((1.0 / x)));
}
return tmp;
}
def code(x): tmp = 0 if x <= 58000000.0: tmp = math.pow(x, -0.5) - math.pow((1.0 + x), -0.5) else: tmp = (1.0 / (x * x)) / (math.pow(x, -0.5) + math.sqrt((1.0 / x))) return tmp
function code(x) tmp = 0.0 if (x <= 58000000.0) tmp = Float64((x ^ -0.5) - (Float64(1.0 + x) ^ -0.5)); else tmp = Float64(Float64(1.0 / Float64(x * x)) / Float64((x ^ -0.5) + sqrt(Float64(1.0 / x)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 58000000.0) tmp = (x ^ -0.5) - ((1.0 + x) ^ -0.5); else tmp = (1.0 / (x * x)) / ((x ^ -0.5) + sqrt((1.0 / x))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 58000000.0], N[(N[Power[x, -0.5], $MachinePrecision] - N[Power[N[(1.0 + x), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(N[Power[x, -0.5], $MachinePrecision] + N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 58000000:\\
\;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x \cdot x}}{{x}^{-0.5} + \sqrt{\frac{1}{x}}}\\
\end{array}
\end{array}
if x < 5.8e7Initial program 99.1%
*-un-lft-identity99.1%
clear-num99.1%
associate-/r/99.1%
prod-diff99.1%
*-un-lft-identity99.1%
fma-neg99.1%
*-un-lft-identity99.1%
inv-pow99.1%
sqrt-pow299.5%
metadata-eval99.5%
pow1/299.5%
pow-flip99.5%
+-commutative99.5%
metadata-eval99.5%
Applied egg-rr99.5%
fma-udef99.5%
neg-mul-199.5%
rem-log-exp99.2%
log-rec99.2%
+-commutative99.2%
log-rec99.2%
rem-log-exp99.5%
sub-neg99.5%
+-inverses99.5%
+-rgt-identity99.5%
Simplified99.5%
if 5.8e7 < x Initial program 37.9%
flip--37.9%
frac-times22.1%
metadata-eval22.1%
add-sqr-sqrt22.4%
frac-times24.4%
metadata-eval24.4%
add-sqr-sqrt37.9%
+-commutative37.9%
pow1/237.9%
pow-flip37.9%
metadata-eval37.9%
inv-pow37.9%
sqrt-pow237.9%
+-commutative37.9%
metadata-eval37.9%
Applied egg-rr37.9%
Taylor expanded in x around inf 81.0%
unpow281.0%
Simplified81.0%
Taylor expanded in x around inf 81.0%
Final simplification90.0%
(FPCore (x) :precision binary64 (if (<= x 1.0) (+ (pow x -0.5) (- -1.0 (* x -0.5))) (/ (/ 1.0 (* x x)) (* (sqrt (/ 1.0 x)) 2.0))))
double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = pow(x, -0.5) + (-1.0 - (x * -0.5));
} else {
tmp = (1.0 / (x * x)) / (sqrt((1.0 / x)) * 2.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) - (x * (-0.5d0)))
else
tmp = (1.0d0 / (x * x)) / (sqrt((1.0d0 / x)) * 2.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 - (x * -0.5));
} else {
tmp = (1.0 / (x * x)) / (Math.sqrt((1.0 / x)) * 2.0);
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.0: tmp = math.pow(x, -0.5) + (-1.0 - (x * -0.5)) else: tmp = (1.0 / (x * x)) / (math.sqrt((1.0 / x)) * 2.0) return tmp
function code(x) tmp = 0.0 if (x <= 1.0) tmp = Float64((x ^ -0.5) + Float64(-1.0 - Float64(x * -0.5))); else tmp = Float64(Float64(1.0 / Float64(x * x)) / Float64(sqrt(Float64(1.0 / x)) * 2.0)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.0) tmp = (x ^ -0.5) + (-1.0 - (x * -0.5)); else tmp = (1.0 / (x * x)) / (sqrt((1.0 / x)) * 2.0); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.0], N[(N[Power[x, -0.5], $MachinePrecision] + N[(-1.0 - N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;{x}^{-0.5} + \left(-1 - x \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x \cdot x}}{\sqrt{\frac{1}{x}} \cdot 2}\\
\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%
neg-mul-1100.0%
rem-log-exp100.0%
log-rec100.0%
+-commutative100.0%
log-rec100.0%
rem-log-exp100.0%
sub-neg100.0%
+-inverses100.0%
+-rgt-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 99.4%
*-commutative99.4%
Simplified99.4%
if 1 < x Initial program 39.2%
flip--39.2%
frac-times23.8%
metadata-eval23.8%
add-sqr-sqrt24.2%
frac-times26.1%
metadata-eval26.1%
add-sqr-sqrt39.3%
+-commutative39.3%
pow1/239.3%
pow-flip39.3%
metadata-eval39.3%
inv-pow39.3%
sqrt-pow239.3%
+-commutative39.3%
metadata-eval39.3%
Applied egg-rr39.3%
Taylor expanded in x around inf 79.6%
unpow279.6%
Simplified79.6%
Taylor expanded in x around inf 79.6%
Final simplification88.9%
(FPCore (x) :precision binary64 (if (<= x 1.0) (+ (pow x -0.5) (- -1.0 (* x -0.5))) (/ (/ 1.0 (* x x)) (+ 1.0 (pow x -0.5)))))
double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = pow(x, -0.5) + (-1.0 - (x * -0.5));
} else {
tmp = (1.0 / (x * x)) / (1.0 + 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)) + ((-1.0d0) - (x * (-0.5d0)))
else
tmp = (1.0d0 / (x * x)) / (1.0d0 + (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) + (-1.0 - (x * -0.5));
} else {
tmp = (1.0 / (x * x)) / (1.0 + Math.pow(x, -0.5));
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.0: tmp = math.pow(x, -0.5) + (-1.0 - (x * -0.5)) else: tmp = (1.0 / (x * x)) / (1.0 + math.pow(x, -0.5)) return tmp
function code(x) tmp = 0.0 if (x <= 1.0) tmp = Float64((x ^ -0.5) + Float64(-1.0 - Float64(x * -0.5))); else tmp = Float64(Float64(1.0 / Float64(x * x)) / Float64(1.0 + (x ^ -0.5))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.0) tmp = (x ^ -0.5) + (-1.0 - (x * -0.5)); else tmp = (1.0 / (x * x)) / (1.0 + (x ^ -0.5)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.0], N[(N[Power[x, -0.5], $MachinePrecision] + N[(-1.0 - N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[Power[x, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;{x}^{-0.5} + \left(-1 - x \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x \cdot x}}{1 + {x}^{-0.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%
neg-mul-1100.0%
rem-log-exp100.0%
log-rec100.0%
+-commutative100.0%
log-rec100.0%
rem-log-exp100.0%
sub-neg100.0%
+-inverses100.0%
+-rgt-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 99.4%
*-commutative99.4%
Simplified99.4%
if 1 < x Initial program 39.2%
flip--39.2%
frac-times23.8%
metadata-eval23.8%
add-sqr-sqrt24.2%
frac-times26.1%
metadata-eval26.1%
add-sqr-sqrt39.3%
+-commutative39.3%
pow1/239.3%
pow-flip39.3%
metadata-eval39.3%
inv-pow39.3%
sqrt-pow239.3%
+-commutative39.3%
metadata-eval39.3%
Applied egg-rr39.3%
Taylor expanded in x around 0 36.9%
Taylor expanded in x around inf 38.3%
unpow279.6%
Simplified38.3%
Final simplification67.0%
(FPCore (x) :precision binary64 (if (<= x 1.0) (+ (pow x -0.5) (- -1.0 (* x -0.5))) (/ 1.0 (* x (+ x (sqrt x))))))
double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = pow(x, -0.5) + (-1.0 - (x * -0.5));
} else {
tmp = 1.0 / (x * (x + sqrt(x)));
}
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) - (x * (-0.5d0)))
else
tmp = 1.0d0 / (x * (x + sqrt(x)))
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 - (x * -0.5));
} else {
tmp = 1.0 / (x * (x + Math.sqrt(x)));
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.0: tmp = math.pow(x, -0.5) + (-1.0 - (x * -0.5)) else: tmp = 1.0 / (x * (x + math.sqrt(x))) return tmp
function code(x) tmp = 0.0 if (x <= 1.0) tmp = Float64((x ^ -0.5) + Float64(-1.0 - Float64(x * -0.5))); else tmp = Float64(1.0 / Float64(x * Float64(x + sqrt(x)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.0) tmp = (x ^ -0.5) + (-1.0 - (x * -0.5)); else tmp = 1.0 / (x * (x + sqrt(x))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.0], N[(N[Power[x, -0.5], $MachinePrecision] + N[(-1.0 - N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(x * N[(x + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;{x}^{-0.5} + \left(-1 - x \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot \left(x + \sqrt{x}\right)}\\
\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%
neg-mul-1100.0%
rem-log-exp100.0%
log-rec100.0%
+-commutative100.0%
log-rec100.0%
rem-log-exp100.0%
sub-neg100.0%
+-inverses100.0%
+-rgt-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 99.4%
*-commutative99.4%
Simplified99.4%
if 1 < x Initial program 39.2%
flip--39.2%
frac-times23.8%
metadata-eval23.8%
add-sqr-sqrt24.2%
frac-times26.1%
metadata-eval26.1%
add-sqr-sqrt39.3%
+-commutative39.3%
pow1/239.3%
pow-flip39.3%
metadata-eval39.3%
inv-pow39.3%
sqrt-pow239.3%
+-commutative39.3%
metadata-eval39.3%
Applied egg-rr39.3%
Taylor expanded in x around inf 79.6%
unpow279.6%
Simplified79.6%
Taylor expanded in x around 0 38.3%
unpow238.3%
associate-*l*38.3%
distribute-rgt-in38.3%
*-lft-identity38.3%
pow-plus38.3%
metadata-eval38.3%
unpow1/238.3%
Simplified38.3%
Final simplification67.0%
(FPCore (x) :precision binary64 (if (<= x 0.8) (+ (pow x -0.5) -1.0) (if (<= x 1.35e+154) (/ 1.0 x) (- (pow (* x x) -0.25)))))
double code(double x) {
double tmp;
if (x <= 0.8) {
tmp = pow(x, -0.5) + -1.0;
} else if (x <= 1.35e+154) {
tmp = 1.0 / x;
} else {
tmp = -pow((x * x), -0.25);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.8d0) then
tmp = (x ** (-0.5d0)) + (-1.0d0)
else if (x <= 1.35d+154) then
tmp = 1.0d0 / x
else
tmp = -((x * x) ** (-0.25d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.8) {
tmp = Math.pow(x, -0.5) + -1.0;
} else if (x <= 1.35e+154) {
tmp = 1.0 / x;
} else {
tmp = -Math.pow((x * x), -0.25);
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.8: tmp = math.pow(x, -0.5) + -1.0 elif x <= 1.35e+154: tmp = 1.0 / x else: tmp = -math.pow((x * x), -0.25) return tmp
function code(x) tmp = 0.0 if (x <= 0.8) tmp = Float64((x ^ -0.5) + -1.0); elseif (x <= 1.35e+154) tmp = Float64(1.0 / x); else tmp = Float64(-(Float64(x * x) ^ -0.25)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.8) tmp = (x ^ -0.5) + -1.0; elseif (x <= 1.35e+154) tmp = 1.0 / x; else tmp = -((x * x) ^ -0.25); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.8], N[(N[Power[x, -0.5], $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[x, 1.35e+154], N[(1.0 / x), $MachinePrecision], (-N[Power[N[(x * x), $MachinePrecision], -0.25], $MachinePrecision])]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.8:\\
\;\;\;\;{x}^{-0.5} + -1\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;-{\left(x \cdot x\right)}^{-0.25}\\
\end{array}
\end{array}
if x < 0.80000000000000004Initial 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%
neg-mul-1100.0%
rem-log-exp100.0%
log-rec100.0%
+-commutative100.0%
log-rec100.0%
rem-log-exp100.0%
sub-neg100.0%
+-inverses100.0%
+-rgt-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 98.8%
if 0.80000000000000004 < x < 1.35000000000000003e154Initial program 10.3%
flip--10.3%
frac-times10.3%
metadata-eval10.3%
add-sqr-sqrt10.5%
frac-times10.8%
metadata-eval10.8%
add-sqr-sqrt10.6%
+-commutative10.6%
pow1/210.6%
pow-flip10.6%
metadata-eval10.6%
inv-pow10.6%
sqrt-pow210.6%
+-commutative10.6%
metadata-eval10.6%
Applied egg-rr10.6%
Taylor expanded in x around 0 8.5%
distribute-rgt-in8.5%
*-lft-identity8.5%
pow-plus8.5%
metadata-eval8.5%
Simplified8.5%
Taylor expanded in x around inf 8.4%
if 1.35000000000000003e154 < x Initial program 65.6%
pow1/265.6%
pow-to-exp4.4%
+-commutative4.4%
log1p-udef4.4%
Applied egg-rr4.4%
Taylor expanded in x around inf 4.0%
mul-1-neg4.0%
Simplified4.0%
inv-pow4.0%
sqrt-pow14.0%
metadata-eval4.0%
metadata-eval4.0%
pow-prod-up4.0%
pow-prod-down65.6%
Applied egg-rr65.6%
Final simplification66.6%
(FPCore (x) :precision binary64 (if (<= x 0.7) (+ (pow x -0.5) -1.0) (/ 1.0 (* x (+ x (sqrt x))))))
double code(double x) {
double tmp;
if (x <= 0.7) {
tmp = pow(x, -0.5) + -1.0;
} else {
tmp = 1.0 / (x * (x + sqrt(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 = 1.0d0 / (x * (x + sqrt(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 = 1.0 / (x * (x + Math.sqrt(x)));
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.7: tmp = math.pow(x, -0.5) + -1.0 else: tmp = 1.0 / (x * (x + math.sqrt(x))) return tmp
function code(x) tmp = 0.0 if (x <= 0.7) tmp = Float64((x ^ -0.5) + -1.0); else tmp = Float64(1.0 / Float64(x * Float64(x + sqrt(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 = 1.0 / (x * (x + sqrt(x))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.7], N[(N[Power[x, -0.5], $MachinePrecision] + -1.0), $MachinePrecision], N[(1.0 / N[(x * N[(x + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.7:\\
\;\;\;\;{x}^{-0.5} + -1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot \left(x + \sqrt{x}\right)}\\
\end{array}
\end{array}
if x < 0.69999999999999996Initial 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%
neg-mul-1100.0%
rem-log-exp100.0%
log-rec100.0%
+-commutative100.0%
log-rec100.0%
rem-log-exp100.0%
sub-neg100.0%
+-inverses100.0%
+-rgt-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 98.8%
if 0.69999999999999996 < x Initial program 39.2%
flip--39.2%
frac-times23.8%
metadata-eval23.8%
add-sqr-sqrt24.2%
frac-times26.1%
metadata-eval26.1%
add-sqr-sqrt39.3%
+-commutative39.3%
pow1/239.3%
pow-flip39.3%
metadata-eval39.3%
inv-pow39.3%
sqrt-pow239.3%
+-commutative39.3%
metadata-eval39.3%
Applied egg-rr39.3%
Taylor expanded in x around inf 79.6%
unpow279.6%
Simplified79.6%
Taylor expanded in x around 0 38.3%
unpow238.3%
associate-*l*38.3%
distribute-rgt-in38.3%
*-lft-identity38.3%
pow-plus38.3%
metadata-eval38.3%
unpow1/238.3%
Simplified38.3%
Final simplification66.7%
(FPCore (x) :precision binary64 (if (<= x 1.35e+154) (/ 1.0 (+ x (sqrt x))) (- (pow (* x x) -0.25))))
double code(double x) {
double tmp;
if (x <= 1.35e+154) {
tmp = 1.0 / (x + sqrt(x));
} else {
tmp = -pow((x * x), -0.25);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 1.35d+154) then
tmp = 1.0d0 / (x + sqrt(x))
else
tmp = -((x * x) ** (-0.25d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 1.35e+154) {
tmp = 1.0 / (x + Math.sqrt(x));
} else {
tmp = -Math.pow((x * x), -0.25);
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.35e+154: tmp = 1.0 / (x + math.sqrt(x)) else: tmp = -math.pow((x * x), -0.25) return tmp
function code(x) tmp = 0.0 if (x <= 1.35e+154) tmp = Float64(1.0 / Float64(x + sqrt(x))); else tmp = Float64(-(Float64(x * x) ^ -0.25)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.35e+154) tmp = 1.0 / (x + sqrt(x)); else tmp = -((x * x) ^ -0.25); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.35e+154], N[(1.0 / N[(x + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[Power[N[(x * x), $MachinePrecision], -0.25], $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{x + \sqrt{x}}\\
\mathbf{else}:\\
\;\;\;\;-{\left(x \cdot x\right)}^{-0.25}\\
\end{array}
\end{array}
if x < 1.35000000000000003e154Initial program 68.2%
flip--68.1%
frac-times67.9%
metadata-eval67.9%
add-sqr-sqrt68.1%
frac-times68.2%
metadata-eval68.2%
add-sqr-sqrt68.1%
+-commutative68.1%
pow1/268.1%
pow-flip68.0%
metadata-eval68.0%
inv-pow68.0%
sqrt-pow268.0%
+-commutative68.0%
metadata-eval68.0%
Applied egg-rr68.0%
Taylor expanded in x around 0 65.4%
Taylor expanded in x around 0 66.3%
distribute-rgt-in66.3%
*-lft-identity66.3%
pow-plus66.4%
metadata-eval66.4%
unpow1/266.4%
Simplified66.4%
if 1.35000000000000003e154 < x Initial program 65.6%
pow1/265.6%
pow-to-exp4.4%
+-commutative4.4%
log1p-udef4.4%
Applied egg-rr4.4%
Taylor expanded in x around inf 4.0%
mul-1-neg4.0%
Simplified4.0%
inv-pow4.0%
sqrt-pow14.0%
metadata-eval4.0%
metadata-eval4.0%
pow-prod-up4.0%
pow-prod-down65.6%
Applied egg-rr65.6%
Final simplification66.2%
(FPCore (x) :precision binary64 (if (<= x 0.8) (+ (pow x -0.5) -1.0) (/ 1.0 x)))
double code(double x) {
double tmp;
if (x <= 0.8) {
tmp = pow(x, -0.5) + -1.0;
} else {
tmp = 1.0 / x;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.8d0) then
tmp = (x ** (-0.5d0)) + (-1.0d0)
else
tmp = 1.0d0 / x
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.8) {
tmp = Math.pow(x, -0.5) + -1.0;
} else {
tmp = 1.0 / x;
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.8: tmp = math.pow(x, -0.5) + -1.0 else: tmp = 1.0 / x return tmp
function code(x) tmp = 0.0 if (x <= 0.8) tmp = Float64((x ^ -0.5) + -1.0); else tmp = Float64(1.0 / x); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.8) tmp = (x ^ -0.5) + -1.0; else tmp = 1.0 / x; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.8], N[(N[Power[x, -0.5], $MachinePrecision] + -1.0), $MachinePrecision], N[(1.0 / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.8:\\
\;\;\;\;{x}^{-0.5} + -1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x}\\
\end{array}
\end{array}
if x < 0.80000000000000004Initial 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%
neg-mul-1100.0%
rem-log-exp100.0%
log-rec100.0%
+-commutative100.0%
log-rec100.0%
rem-log-exp100.0%
sub-neg100.0%
+-inverses100.0%
+-rgt-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 98.8%
if 0.80000000000000004 < x Initial program 39.2%
flip--39.2%
frac-times23.8%
metadata-eval23.8%
add-sqr-sqrt24.2%
frac-times26.1%
metadata-eval26.1%
add-sqr-sqrt39.3%
+-commutative39.3%
pow1/239.3%
pow-flip39.3%
metadata-eval39.3%
inv-pow39.3%
sqrt-pow239.3%
+-commutative39.3%
metadata-eval39.3%
Applied egg-rr39.3%
Taylor expanded in x around 0 7.7%
distribute-rgt-in7.7%
*-lft-identity7.7%
pow-plus7.7%
metadata-eval7.7%
Simplified7.7%
Taylor expanded in x around inf 7.7%
Final simplification50.4%
(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 67.5%
flip--67.4%
frac-times59.2%
metadata-eval59.2%
add-sqr-sqrt59.4%
frac-times60.4%
metadata-eval60.4%
add-sqr-sqrt67.4%
+-commutative67.4%
pow1/267.4%
pow-flip67.3%
metadata-eval67.3%
inv-pow67.3%
sqrt-pow267.3%
+-commutative67.3%
metadata-eval67.3%
Applied egg-rr67.3%
Taylor expanded in x around 0 49.8%
distribute-rgt-in49.8%
*-lft-identity49.8%
pow-plus50.0%
metadata-eval50.0%
Simplified50.0%
Taylor expanded in x around inf 7.3%
Final simplification7.3%
(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 67.5%
Taylor expanded in x around 0 47.5%
Taylor expanded in x around inf 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 2023293
(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)))))