
(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 (if (<= (+ (/ 1.0 (sqrt x)) (/ -1.0 (sqrt (+ x 1.0)))) 0.0) (* 0.5 (/ (pow (+ x 1.0) -0.5) x)) (* (pow x -0.5) (/ 1.0 (+ (+ x 1.0) (sqrt (+ x (* x x))))))))
double code(double x) {
double tmp;
if (((1.0 / sqrt(x)) + (-1.0 / sqrt((x + 1.0)))) <= 0.0) {
tmp = 0.5 * (pow((x + 1.0), -0.5) / x);
} else {
tmp = pow(x, -0.5) * (1.0 / ((x + 1.0) + sqrt((x + (x * x)))));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (((1.0d0 / sqrt(x)) + ((-1.0d0) / sqrt((x + 1.0d0)))) <= 0.0d0) then
tmp = 0.5d0 * (((x + 1.0d0) ** (-0.5d0)) / x)
else
tmp = (x ** (-0.5d0)) * (1.0d0 / ((x + 1.0d0) + sqrt((x + (x * 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((x + 1.0)))) <= 0.0) {
tmp = 0.5 * (Math.pow((x + 1.0), -0.5) / x);
} else {
tmp = Math.pow(x, -0.5) * (1.0 / ((x + 1.0) + Math.sqrt((x + (x * x)))));
}
return tmp;
}
def code(x): tmp = 0 if ((1.0 / math.sqrt(x)) + (-1.0 / math.sqrt((x + 1.0)))) <= 0.0: tmp = 0.5 * (math.pow((x + 1.0), -0.5) / x) else: tmp = math.pow(x, -0.5) * (1.0 / ((x + 1.0) + math.sqrt((x + (x * x))))) return tmp
function code(x) tmp = 0.0 if (Float64(Float64(1.0 / sqrt(x)) + Float64(-1.0 / sqrt(Float64(x + 1.0)))) <= 0.0) tmp = Float64(0.5 * Float64((Float64(x + 1.0) ^ -0.5) / x)); else tmp = Float64((x ^ -0.5) * Float64(1.0 / Float64(Float64(x + 1.0) + sqrt(Float64(x + Float64(x * x)))))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (((1.0 / sqrt(x)) + (-1.0 / sqrt((x + 1.0)))) <= 0.0) tmp = 0.5 * (((x + 1.0) ^ -0.5) / x); else tmp = (x ^ -0.5) * (1.0 / ((x + 1.0) + sqrt((x + (x * 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[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0], N[(0.5 * N[(N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] * N[(1.0 / N[(N[(x + 1.0), $MachinePrecision] + N[Sqrt[N[(x + N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{\sqrt{x + 1}} \leq 0:\\
\;\;\;\;0.5 \cdot \frac{{\left(x + 1\right)}^{-0.5}}{x}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{1}{\left(x + 1\right) + \sqrt{x + x \cdot x}}\\
\end{array}
\end{array}
if (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) < 0.0Initial program 47.2%
frac-sub47.3%
div-inv47.3%
*-un-lft-identity47.3%
+-commutative47.3%
*-rgt-identity47.3%
metadata-eval47.3%
frac-times47.3%
un-div-inv47.3%
pow1/247.3%
pow-flip47.3%
metadata-eval47.3%
+-commutative47.3%
Applied egg-rr47.3%
associate-*r/47.3%
Simplified47.3%
add-sqr-sqrt47.3%
pow-prod-down47.3%
unpow247.3%
*-commutative47.3%
flip--47.9%
associate-*r/47.9%
unpow247.9%
pow-prod-down47.9%
add-sqr-sqrt47.9%
add-sqr-sqrt29.6%
add-sqr-sqrt48.7%
associate--l+99.5%
Applied egg-rr99.5%
associate-/l*99.5%
+-inverses99.5%
metadata-eval99.5%
/-rgt-identity99.5%
+-commutative99.5%
Simplified99.5%
Taylor expanded in x around inf 99.7%
div-inv99.6%
+-commutative99.6%
div-inv99.6%
inv-pow99.6%
metadata-eval99.6%
pow-prod-up99.4%
inv-pow99.4%
sqrt-pow299.3%
+-commutative99.3%
metadata-eval99.3%
associate-*l*99.3%
pow-prod-up99.7%
metadata-eval99.7%
inv-pow99.7%
+-commutative99.7%
Applied egg-rr99.7%
associate-*l/99.8%
*-lft-identity99.8%
Simplified99.8%
if 0.0 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) Initial program 99.2%
frac-sub99.3%
div-inv99.3%
*-un-lft-identity99.3%
+-commutative99.3%
*-rgt-identity99.3%
metadata-eval99.3%
frac-times99.3%
un-div-inv99.3%
pow1/299.3%
pow-flip99.7%
metadata-eval99.7%
+-commutative99.7%
Applied egg-rr99.7%
associate-*r/99.7%
Simplified99.7%
add-sqr-sqrt99.3%
pow-prod-down98.8%
unpow298.8%
*-commutative98.8%
flip--99.1%
associate-*r/99.1%
unpow299.1%
pow-prod-down99.5%
add-sqr-sqrt99.9%
add-sqr-sqrt99.8%
add-sqr-sqrt99.8%
associate--l+99.8%
Applied egg-rr99.8%
associate-/l*99.8%
+-inverses99.8%
metadata-eval99.8%
/-rgt-identity99.8%
+-commutative99.8%
Simplified99.8%
associate-/l/99.8%
div-inv99.8%
+-commutative99.8%
distribute-rgt-in99.8%
add-sqr-sqrt99.9%
+-commutative99.9%
sqrt-unprod99.9%
distribute-lft-in99.9%
*-rgt-identity99.9%
Applied egg-rr99.9%
Final simplification99.8%
(FPCore (x) :precision binary64 (if (<= (+ (/ 1.0 (sqrt x)) (/ -1.0 (sqrt (+ x 1.0)))) 0.0) (* 0.5 (/ (pow (+ x 1.0) -0.5) x)) (/ (pow x -0.5) (+ x (+ 1.0 (sqrt (+ x (* x x))))))))
double code(double x) {
double tmp;
if (((1.0 / sqrt(x)) + (-1.0 / sqrt((x + 1.0)))) <= 0.0) {
tmp = 0.5 * (pow((x + 1.0), -0.5) / x);
} else {
tmp = pow(x, -0.5) / (x + (1.0 + sqrt((x + (x * x)))));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (((1.0d0 / sqrt(x)) + ((-1.0d0) / sqrt((x + 1.0d0)))) <= 0.0d0) then
tmp = 0.5d0 * (((x + 1.0d0) ** (-0.5d0)) / x)
else
tmp = (x ** (-0.5d0)) / (x + (1.0d0 + sqrt((x + (x * 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((x + 1.0)))) <= 0.0) {
tmp = 0.5 * (Math.pow((x + 1.0), -0.5) / x);
} else {
tmp = Math.pow(x, -0.5) / (x + (1.0 + Math.sqrt((x + (x * x)))));
}
return tmp;
}
def code(x): tmp = 0 if ((1.0 / math.sqrt(x)) + (-1.0 / math.sqrt((x + 1.0)))) <= 0.0: tmp = 0.5 * (math.pow((x + 1.0), -0.5) / x) else: tmp = math.pow(x, -0.5) / (x + (1.0 + math.sqrt((x + (x * x))))) return tmp
function code(x) tmp = 0.0 if (Float64(Float64(1.0 / sqrt(x)) + Float64(-1.0 / sqrt(Float64(x + 1.0)))) <= 0.0) tmp = Float64(0.5 * Float64((Float64(x + 1.0) ^ -0.5) / x)); else tmp = Float64((x ^ -0.5) / Float64(x + Float64(1.0 + sqrt(Float64(x + Float64(x * x)))))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (((1.0 / sqrt(x)) + (-1.0 / sqrt((x + 1.0)))) <= 0.0) tmp = 0.5 * (((x + 1.0) ^ -0.5) / x); else tmp = (x ^ -0.5) / (x + (1.0 + sqrt((x + (x * 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[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0], N[(0.5 * N[(N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] / N[(x + N[(1.0 + N[Sqrt[N[(x + N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{\sqrt{x + 1}} \leq 0:\\
\;\;\;\;0.5 \cdot \frac{{\left(x + 1\right)}^{-0.5}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{{x}^{-0.5}}{x + \left(1 + \sqrt{x + x \cdot x}\right)}\\
\end{array}
\end{array}
if (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) < 0.0Initial program 47.2%
frac-sub47.3%
div-inv47.3%
*-un-lft-identity47.3%
+-commutative47.3%
*-rgt-identity47.3%
metadata-eval47.3%
frac-times47.3%
un-div-inv47.3%
pow1/247.3%
pow-flip47.3%
metadata-eval47.3%
+-commutative47.3%
Applied egg-rr47.3%
associate-*r/47.3%
Simplified47.3%
add-sqr-sqrt47.3%
pow-prod-down47.3%
unpow247.3%
*-commutative47.3%
flip--47.9%
associate-*r/47.9%
unpow247.9%
pow-prod-down47.9%
add-sqr-sqrt47.9%
add-sqr-sqrt29.6%
add-sqr-sqrt48.7%
associate--l+99.5%
Applied egg-rr99.5%
associate-/l*99.5%
+-inverses99.5%
metadata-eval99.5%
/-rgt-identity99.5%
+-commutative99.5%
Simplified99.5%
Taylor expanded in x around inf 99.7%
div-inv99.6%
+-commutative99.6%
div-inv99.6%
inv-pow99.6%
metadata-eval99.6%
pow-prod-up99.4%
inv-pow99.4%
sqrt-pow299.3%
+-commutative99.3%
metadata-eval99.3%
associate-*l*99.3%
pow-prod-up99.7%
metadata-eval99.7%
inv-pow99.7%
+-commutative99.7%
Applied egg-rr99.7%
associate-*l/99.8%
*-lft-identity99.8%
Simplified99.8%
if 0.0 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) Initial program 99.2%
frac-sub99.3%
div-inv99.3%
*-un-lft-identity99.3%
+-commutative99.3%
*-rgt-identity99.3%
metadata-eval99.3%
frac-times99.3%
un-div-inv99.3%
pow1/299.3%
pow-flip99.7%
metadata-eval99.7%
+-commutative99.7%
Applied egg-rr99.7%
associate-*r/99.7%
Simplified99.7%
add-sqr-sqrt99.3%
pow-prod-down98.8%
unpow298.8%
*-commutative98.8%
flip--99.1%
associate-*r/99.1%
unpow299.1%
pow-prod-down99.5%
add-sqr-sqrt99.9%
add-sqr-sqrt99.8%
add-sqr-sqrt99.8%
associate--l+99.8%
Applied egg-rr99.8%
associate-/l*99.8%
+-inverses99.8%
metadata-eval99.8%
/-rgt-identity99.8%
+-commutative99.8%
Simplified99.8%
expm1-log1p-u92.6%
expm1-udef92.2%
associate-/l/92.2%
+-commutative92.2%
distribute-rgt-in92.2%
add-sqr-sqrt92.2%
+-commutative92.2%
sqrt-unprod92.2%
distribute-lft-in92.2%
*-rgt-identity92.2%
Applied egg-rr92.2%
expm1-def92.6%
expm1-log1p99.9%
associate-+l+99.9%
Simplified99.9%
Final simplification99.8%
(FPCore (x)
:precision binary64
(let* ((t_0 (/ -1.0 (sqrt (+ x 1.0)))))
(if (<= (+ (/ 1.0 (sqrt x)) t_0) 2e-13)
(* 0.5 (/ (pow (+ x 1.0) -0.5) x))
(+ (pow x -0.5) t_0))))
double code(double x) {
double t_0 = -1.0 / sqrt((x + 1.0));
double tmp;
if (((1.0 / sqrt(x)) + t_0) <= 2e-13) {
tmp = 0.5 * (pow((x + 1.0), -0.5) / x);
} else {
tmp = 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) / sqrt((x + 1.0d0))
if (((1.0d0 / sqrt(x)) + t_0) <= 2d-13) then
tmp = 0.5d0 * (((x + 1.0d0) ** (-0.5d0)) / x)
else
tmp = (x ** (-0.5d0)) + t_0
end if
code = tmp
end function
public static double code(double x) {
double t_0 = -1.0 / Math.sqrt((x + 1.0));
double tmp;
if (((1.0 / Math.sqrt(x)) + t_0) <= 2e-13) {
tmp = 0.5 * (Math.pow((x + 1.0), -0.5) / x);
} else {
tmp = Math.pow(x, -0.5) + t_0;
}
return tmp;
}
def code(x): t_0 = -1.0 / math.sqrt((x + 1.0)) tmp = 0 if ((1.0 / math.sqrt(x)) + t_0) <= 2e-13: tmp = 0.5 * (math.pow((x + 1.0), -0.5) / x) else: tmp = math.pow(x, -0.5) + t_0 return tmp
function code(x) t_0 = Float64(-1.0 / sqrt(Float64(x + 1.0))) tmp = 0.0 if (Float64(Float64(1.0 / sqrt(x)) + t_0) <= 2e-13) tmp = Float64(0.5 * Float64((Float64(x + 1.0) ^ -0.5) / x)); else tmp = Float64((x ^ -0.5) + t_0); end return tmp end
function tmp_2 = code(x) t_0 = -1.0 / sqrt((x + 1.0)); tmp = 0.0; if (((1.0 / sqrt(x)) + t_0) <= 2e-13) tmp = 0.5 * (((x + 1.0) ^ -0.5) / x); else tmp = (x ^ -0.5) + t_0; end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(-1.0 / N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], 2e-13], N[(0.5 * N[(N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] + t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-1}{\sqrt{x + 1}}\\
\mathbf{if}\;\frac{1}{\sqrt{x}} + t_0 \leq 2 \cdot 10^{-13}:\\
\;\;\;\;0.5 \cdot \frac{{\left(x + 1\right)}^{-0.5}}{x}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} + t_0\\
\end{array}
\end{array}
if (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) < 2.0000000000000001e-13Initial program 47.2%
frac-sub47.5%
div-inv47.5%
*-un-lft-identity47.5%
+-commutative47.5%
*-rgt-identity47.5%
metadata-eval47.5%
frac-times47.5%
un-div-inv47.5%
pow1/247.5%
pow-flip47.5%
metadata-eval47.5%
+-commutative47.5%
Applied egg-rr47.5%
associate-*r/47.5%
Simplified47.5%
add-sqr-sqrt47.5%
pow-prod-down47.5%
unpow247.5%
*-commutative47.5%
flip--48.3%
associate-*r/48.3%
unpow248.3%
pow-prod-down48.3%
add-sqr-sqrt48.3%
add-sqr-sqrt30.1%
add-sqr-sqrt49.1%
associate--l+99.5%
Applied egg-rr99.5%
associate-/l*99.5%
+-inverses99.5%
metadata-eval99.5%
/-rgt-identity99.5%
+-commutative99.5%
Simplified99.5%
Taylor expanded in x around inf 99.4%
div-inv99.3%
+-commutative99.3%
div-inv99.3%
inv-pow99.3%
metadata-eval99.3%
pow-prod-up99.1%
inv-pow99.1%
sqrt-pow299.0%
+-commutative99.0%
metadata-eval99.0%
associate-*l*99.0%
pow-prod-up99.4%
metadata-eval99.4%
inv-pow99.4%
+-commutative99.4%
Applied egg-rr99.4%
associate-*l/99.5%
*-lft-identity99.5%
Simplified99.5%
if 2.0000000000000001e-13 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) Initial program 99.5%
add-log-exp6.1%
*-un-lft-identity6.1%
log-prod6.1%
metadata-eval6.1%
add-log-exp99.5%
pow1/299.5%
pow-flip100.0%
metadata-eval100.0%
Applied egg-rr100.0%
+-lft-identity100.0%
Simplified100.0%
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 73.2%
frac-sub73.3%
div-inv73.3%
*-un-lft-identity73.3%
+-commutative73.3%
*-rgt-identity73.3%
metadata-eval73.3%
frac-times73.3%
un-div-inv73.3%
pow1/273.3%
pow-flip73.5%
metadata-eval73.5%
+-commutative73.5%
Applied egg-rr73.5%
associate-*r/73.5%
Simplified73.5%
add-sqr-sqrt73.3%
pow-prod-down73.1%
unpow273.1%
*-commutative73.1%
flip--73.5%
associate-*r/73.5%
unpow273.5%
pow-prod-down73.7%
add-sqr-sqrt73.9%
add-sqr-sqrt64.7%
add-sqr-sqrt74.2%
associate--l+99.6%
Applied egg-rr99.6%
associate-/l*99.6%
+-inverses99.6%
metadata-eval99.6%
/-rgt-identity99.6%
+-commutative99.6%
Simplified99.6%
associate-/l/99.6%
*-un-lft-identity99.6%
times-frac99.6%
pow1/299.6%
pow-flip99.6%
metadata-eval99.6%
+-commutative99.6%
+-commutative99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (x) :precision binary64 (let* ((t_0 (sqrt (+ x 1.0)))) (/ (/ (pow x -0.5) (+ (sqrt x) t_0)) t_0)))
double code(double x) {
double t_0 = sqrt((x + 1.0));
return (pow(x, -0.5) / (sqrt(x) + t_0)) / 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)) / (sqrt(x) + t_0)) / t_0
end function
public static double code(double x) {
double t_0 = Math.sqrt((x + 1.0));
return (Math.pow(x, -0.5) / (Math.sqrt(x) + t_0)) / t_0;
}
def code(x): t_0 = math.sqrt((x + 1.0)) return (math.pow(x, -0.5) / (math.sqrt(x) + t_0)) / t_0
function code(x) t_0 = sqrt(Float64(x + 1.0)) return Float64(Float64((x ^ -0.5) / Float64(sqrt(x) + t_0)) / t_0) end
function tmp = code(x) t_0 = sqrt((x + 1.0)); tmp = ((x ^ -0.5) / (sqrt(x) + t_0)) / t_0; end
code[x_] := Block[{t$95$0 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[Power[x, -0.5], $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{x + 1}\\
\frac{\frac{{x}^{-0.5}}{\sqrt{x} + t_0}}{t_0}
\end{array}
\end{array}
Initial program 73.2%
frac-sub73.3%
div-inv73.3%
*-un-lft-identity73.3%
+-commutative73.3%
*-rgt-identity73.3%
metadata-eval73.3%
frac-times73.3%
un-div-inv73.3%
pow1/273.3%
pow-flip73.5%
metadata-eval73.5%
+-commutative73.5%
Applied egg-rr73.5%
associate-*r/73.5%
Simplified73.5%
add-sqr-sqrt73.3%
pow-prod-down73.1%
unpow273.1%
*-commutative73.1%
flip--73.5%
associate-*r/73.5%
unpow273.5%
pow-prod-down73.7%
add-sqr-sqrt73.9%
add-sqr-sqrt64.7%
add-sqr-sqrt74.2%
associate--l+99.6%
Applied egg-rr99.6%
associate-/l*99.6%
+-inverses99.6%
metadata-eval99.6%
/-rgt-identity99.6%
+-commutative99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x) :precision binary64 (let* ((t_0 (sqrt (+ x 1.0)))) (/ (/ 1.0 (+ x (* (sqrt x) t_0))) t_0)))
double code(double x) {
double t_0 = sqrt((x + 1.0));
return (1.0 / (x + (sqrt(x) * t_0))) / t_0;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
t_0 = sqrt((x + 1.0d0))
code = (1.0d0 / (x + (sqrt(x) * t_0))) / t_0
end function
public static double code(double x) {
double t_0 = Math.sqrt((x + 1.0));
return (1.0 / (x + (Math.sqrt(x) * t_0))) / t_0;
}
def code(x): t_0 = math.sqrt((x + 1.0)) return (1.0 / (x + (math.sqrt(x) * t_0))) / t_0
function code(x) t_0 = sqrt(Float64(x + 1.0)) return Float64(Float64(1.0 / Float64(x + Float64(sqrt(x) * t_0))) / t_0) end
function tmp = code(x) t_0 = sqrt((x + 1.0)); tmp = (1.0 / (x + (sqrt(x) * t_0))) / t_0; end
code[x_] := Block[{t$95$0 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, N[(N[(1.0 / N[(x + N[(N[Sqrt[x], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{x + 1}\\
\frac{\frac{1}{x + \sqrt{x} \cdot t_0}}{t_0}
\end{array}
\end{array}
Initial program 73.2%
frac-sub73.3%
div-inv73.3%
*-un-lft-identity73.3%
+-commutative73.3%
*-rgt-identity73.3%
metadata-eval73.3%
frac-times73.3%
un-div-inv73.3%
pow1/273.3%
pow-flip73.5%
metadata-eval73.5%
+-commutative73.5%
Applied egg-rr73.5%
associate-*r/73.5%
Simplified73.5%
flip--73.9%
metadata-eval73.9%
pow-flip73.7%
pow1/273.7%
frac-times73.7%
add-sqr-sqrt64.5%
add-sqr-sqrt74.1%
associate--l+99.3%
Applied egg-rr99.3%
*-rgt-identity99.3%
+-inverses99.3%
metadata-eval99.3%
*-commutative99.3%
+-commutative99.3%
distribute-lft-in99.3%
rem-square-sqrt99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (x) :precision binary64 (let* ((t_0 (pow (+ x 1.0) -0.5))) (if (<= x 50000000.0) (- (pow x -0.5) t_0) (* 0.5 (/ t_0 x)))))
double code(double x) {
double t_0 = pow((x + 1.0), -0.5);
double tmp;
if (x <= 50000000.0) {
tmp = pow(x, -0.5) - t_0;
} else {
tmp = 0.5 * (t_0 / x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = (x + 1.0d0) ** (-0.5d0)
if (x <= 50000000.0d0) then
tmp = (x ** (-0.5d0)) - t_0
else
tmp = 0.5d0 * (t_0 / x)
end if
code = tmp
end function
public static double code(double x) {
double t_0 = Math.pow((x + 1.0), -0.5);
double tmp;
if (x <= 50000000.0) {
tmp = Math.pow(x, -0.5) - t_0;
} else {
tmp = 0.5 * (t_0 / x);
}
return tmp;
}
def code(x): t_0 = math.pow((x + 1.0), -0.5) tmp = 0 if x <= 50000000.0: tmp = math.pow(x, -0.5) - t_0 else: tmp = 0.5 * (t_0 / x) return tmp
function code(x) t_0 = Float64(x + 1.0) ^ -0.5 tmp = 0.0 if (x <= 50000000.0) tmp = Float64((x ^ -0.5) - t_0); else tmp = Float64(0.5 * Float64(t_0 / x)); end return tmp end
function tmp_2 = code(x) t_0 = (x + 1.0) ^ -0.5; tmp = 0.0; if (x <= 50000000.0) tmp = (x ^ -0.5) - t_0; else tmp = 0.5 * (t_0 / x); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[x, 50000000.0], N[(N[Power[x, -0.5], $MachinePrecision] - t$95$0), $MachinePrecision], N[(0.5 * N[(t$95$0 / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + 1\right)}^{-0.5}\\
\mathbf{if}\;x \leq 50000000:\\
\;\;\;\;{x}^{-0.5} - t_0\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{t_0}{x}\\
\end{array}
\end{array}
if x < 5e7Initial 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-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%
if 5e7 < x Initial program 47.2%
frac-sub47.5%
div-inv47.5%
*-un-lft-identity47.5%
+-commutative47.5%
*-rgt-identity47.5%
metadata-eval47.5%
frac-times47.5%
un-div-inv47.5%
pow1/247.5%
pow-flip47.5%
metadata-eval47.5%
+-commutative47.5%
Applied egg-rr47.5%
associate-*r/47.5%
Simplified47.5%
add-sqr-sqrt47.5%
pow-prod-down47.5%
unpow247.5%
*-commutative47.5%
flip--48.3%
associate-*r/48.3%
unpow248.3%
pow-prod-down48.3%
add-sqr-sqrt48.3%
add-sqr-sqrt30.1%
add-sqr-sqrt49.1%
associate--l+99.5%
Applied egg-rr99.5%
associate-/l*99.5%
+-inverses99.5%
metadata-eval99.5%
/-rgt-identity99.5%
+-commutative99.5%
Simplified99.5%
Taylor expanded in x around inf 99.4%
div-inv99.3%
+-commutative99.3%
div-inv99.3%
inv-pow99.3%
metadata-eval99.3%
pow-prod-up99.1%
inv-pow99.1%
sqrt-pow299.0%
+-commutative99.0%
metadata-eval99.0%
associate-*l*99.0%
pow-prod-up99.4%
metadata-eval99.4%
inv-pow99.4%
+-commutative99.4%
Applied egg-rr99.4%
associate-*l/99.5%
*-lft-identity99.5%
Simplified99.5%
Final simplification99.7%
(FPCore (x) :precision binary64 (if (<= x 1.15) (- (pow x -0.5) (/ 1.0 (+ 1.0 (* x 0.5)))) (* 0.5 (/ (pow (+ x 1.0) -0.5) x))))
double code(double x) {
double tmp;
if (x <= 1.15) {
tmp = pow(x, -0.5) - (1.0 / (1.0 + (x * 0.5)));
} else {
tmp = 0.5 * (pow((x + 1.0), -0.5) / x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 1.15d0) then
tmp = (x ** (-0.5d0)) - (1.0d0 / (1.0d0 + (x * 0.5d0)))
else
tmp = 0.5d0 * (((x + 1.0d0) ** (-0.5d0)) / x)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 1.15) {
tmp = Math.pow(x, -0.5) - (1.0 / (1.0 + (x * 0.5)));
} else {
tmp = 0.5 * (Math.pow((x + 1.0), -0.5) / x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.15: tmp = math.pow(x, -0.5) - (1.0 / (1.0 + (x * 0.5))) else: tmp = 0.5 * (math.pow((x + 1.0), -0.5) / x) return tmp
function code(x) tmp = 0.0 if (x <= 1.15) tmp = Float64((x ^ -0.5) - Float64(1.0 / Float64(1.0 + Float64(x * 0.5)))); else tmp = Float64(0.5 * Float64((Float64(x + 1.0) ^ -0.5) / x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.15) tmp = (x ^ -0.5) - (1.0 / (1.0 + (x * 0.5))); else tmp = 0.5 * (((x + 1.0) ^ -0.5) / x); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.15], N[(N[Power[x, -0.5], $MachinePrecision] - N[(1.0 / N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.15:\\
\;\;\;\;{x}^{-0.5} - \frac{1}{1 + x \cdot 0.5}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{{\left(x + 1\right)}^{-0.5}}{x}\\
\end{array}
\end{array}
if x < 1.1499999999999999Initial program 99.5%
add-log-exp6.1%
*-un-lft-identity6.1%
log-prod6.1%
metadata-eval6.1%
add-log-exp99.5%
pow1/299.5%
pow-flip100.0%
metadata-eval100.0%
Applied egg-rr100.0%
+-lft-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 98.8%
if 1.1499999999999999 < x Initial program 47.2%
frac-sub47.5%
div-inv47.5%
*-un-lft-identity47.5%
+-commutative47.5%
*-rgt-identity47.5%
metadata-eval47.5%
frac-times47.5%
un-div-inv47.5%
pow1/247.5%
pow-flip47.5%
metadata-eval47.5%
+-commutative47.5%
Applied egg-rr47.5%
associate-*r/47.5%
Simplified47.5%
add-sqr-sqrt47.5%
pow-prod-down47.5%
unpow247.5%
*-commutative47.5%
flip--48.3%
associate-*r/48.3%
unpow248.3%
pow-prod-down48.3%
add-sqr-sqrt48.3%
add-sqr-sqrt30.1%
add-sqr-sqrt49.1%
associate--l+99.5%
Applied egg-rr99.5%
associate-/l*99.5%
+-inverses99.5%
metadata-eval99.5%
/-rgt-identity99.5%
+-commutative99.5%
Simplified99.5%
Taylor expanded in x around inf 99.4%
div-inv99.3%
+-commutative99.3%
div-inv99.3%
inv-pow99.3%
metadata-eval99.3%
pow-prod-up99.1%
inv-pow99.1%
sqrt-pow299.0%
+-commutative99.0%
metadata-eval99.0%
associate-*l*99.0%
pow-prod-up99.4%
metadata-eval99.4%
inv-pow99.4%
+-commutative99.4%
Applied egg-rr99.4%
associate-*l/99.5%
*-lft-identity99.5%
Simplified99.5%
Final simplification99.2%
(FPCore (x) :precision binary64 (if (<= x 0.48) (+ (pow x -0.5) -1.0) (* 0.5 (/ (pow (+ x 1.0) -0.5) x))))
double code(double x) {
double tmp;
if (x <= 0.48) {
tmp = pow(x, -0.5) + -1.0;
} else {
tmp = 0.5 * (pow((x + 1.0), -0.5) / x);
}
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 + 1.0d0) ** (-0.5d0)) / x)
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 * (Math.pow((x + 1.0), -0.5) / x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.48: tmp = math.pow(x, -0.5) + -1.0 else: tmp = 0.5 * (math.pow((x + 1.0), -0.5) / x) return tmp
function code(x) tmp = 0.0 if (x <= 0.48) tmp = Float64((x ^ -0.5) + -1.0); else tmp = Float64(0.5 * Float64((Float64(x + 1.0) ^ -0.5) / x)); 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 + 1.0) ^ -0.5) / x); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.48], N[(N[Power[x, -0.5], $MachinePrecision] + -1.0), $MachinePrecision], N[(0.5 * N[(N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.48:\\
\;\;\;\;{x}^{-0.5} + -1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{{\left(x + 1\right)}^{-0.5}}{x}\\
\end{array}
\end{array}
if x < 0.47999999999999998Initial program 99.5%
sub-neg99.5%
+-commutative99.5%
add-sqr-sqrt99.5%
distribute-rgt-neg-in99.5%
fma-def99.5%
inv-pow99.5%
sqrt-pow299.5%
+-commutative99.5%
metadata-eval99.5%
inv-pow99.5%
sqrt-pow299.5%
+-commutative99.5%
metadata-eval99.5%
pow1/299.5%
pow-flip100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 97.9%
if 0.47999999999999998 < x Initial program 47.2%
frac-sub47.5%
div-inv47.5%
*-un-lft-identity47.5%
+-commutative47.5%
*-rgt-identity47.5%
metadata-eval47.5%
frac-times47.5%
un-div-inv47.5%
pow1/247.5%
pow-flip47.5%
metadata-eval47.5%
+-commutative47.5%
Applied egg-rr47.5%
associate-*r/47.5%
Simplified47.5%
add-sqr-sqrt47.5%
pow-prod-down47.5%
unpow247.5%
*-commutative47.5%
flip--48.3%
associate-*r/48.3%
unpow248.3%
pow-prod-down48.3%
add-sqr-sqrt48.3%
add-sqr-sqrt30.1%
add-sqr-sqrt49.1%
associate--l+99.5%
Applied egg-rr99.5%
associate-/l*99.5%
+-inverses99.5%
metadata-eval99.5%
/-rgt-identity99.5%
+-commutative99.5%
Simplified99.5%
Taylor expanded in x around inf 99.4%
div-inv99.3%
+-commutative99.3%
div-inv99.3%
inv-pow99.3%
metadata-eval99.3%
pow-prod-up99.1%
inv-pow99.1%
sqrt-pow299.0%
+-commutative99.0%
metadata-eval99.0%
associate-*l*99.0%
pow-prod-up99.4%
metadata-eval99.4%
inv-pow99.4%
+-commutative99.4%
Applied egg-rr99.4%
associate-*l/99.5%
*-lft-identity99.5%
Simplified99.5%
Final simplification98.7%
(FPCore (x) :precision binary64 (if (<= x 0.7) (+ (+ (pow x -0.5) (* x 0.5)) -1.0) (* 0.5 (/ (pow (+ x 1.0) -0.5) x))))
double code(double x) {
double tmp;
if (x <= 0.7) {
tmp = (pow(x, -0.5) + (x * 0.5)) + -1.0;
} else {
tmp = 0.5 * (pow((x + 1.0), -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)) + (x * 0.5d0)) + (-1.0d0)
else
tmp = 0.5d0 * (((x + 1.0d0) ** (-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) + (x * 0.5)) + -1.0;
} else {
tmp = 0.5 * (Math.pow((x + 1.0), -0.5) / x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.7: tmp = (math.pow(x, -0.5) + (x * 0.5)) + -1.0 else: tmp = 0.5 * (math.pow((x + 1.0), -0.5) / x) return tmp
function code(x) tmp = 0.0 if (x <= 0.7) tmp = Float64(Float64((x ^ -0.5) + Float64(x * 0.5)) + -1.0); else tmp = Float64(0.5 * Float64((Float64(x + 1.0) ^ -0.5) / x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.7) tmp = ((x ^ -0.5) + (x * 0.5)) + -1.0; else tmp = 0.5 * (((x + 1.0) ^ -0.5) / x); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.7], N[(N[(N[Power[x, -0.5], $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(0.5 * N[(N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.7:\\
\;\;\;\;\left({x}^{-0.5} + x \cdot 0.5\right) + -1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{{\left(x + 1\right)}^{-0.5}}{x}\\
\end{array}
\end{array}
if x < 0.69999999999999996Initial program 99.5%
sub-neg99.5%
+-commutative99.5%
add-sqr-sqrt99.5%
distribute-rgt-neg-in99.5%
fma-def99.5%
inv-pow99.5%
sqrt-pow299.5%
+-commutative99.5%
metadata-eval99.5%
inv-pow99.5%
sqrt-pow299.5%
+-commutative99.5%
metadata-eval99.5%
pow1/299.5%
pow-flip100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 98.8%
if 0.69999999999999996 < x Initial program 47.2%
frac-sub47.5%
div-inv47.5%
*-un-lft-identity47.5%
+-commutative47.5%
*-rgt-identity47.5%
metadata-eval47.5%
frac-times47.5%
un-div-inv47.5%
pow1/247.5%
pow-flip47.5%
metadata-eval47.5%
+-commutative47.5%
Applied egg-rr47.5%
associate-*r/47.5%
Simplified47.5%
add-sqr-sqrt47.5%
pow-prod-down47.5%
unpow247.5%
*-commutative47.5%
flip--48.3%
associate-*r/48.3%
unpow248.3%
pow-prod-down48.3%
add-sqr-sqrt48.3%
add-sqr-sqrt30.1%
add-sqr-sqrt49.1%
associate--l+99.5%
Applied egg-rr99.5%
associate-/l*99.5%
+-inverses99.5%
metadata-eval99.5%
/-rgt-identity99.5%
+-commutative99.5%
Simplified99.5%
Taylor expanded in x around inf 99.4%
div-inv99.3%
+-commutative99.3%
div-inv99.3%
inv-pow99.3%
metadata-eval99.3%
pow-prod-up99.1%
inv-pow99.1%
sqrt-pow299.0%
+-commutative99.0%
metadata-eval99.0%
associate-*l*99.0%
pow-prod-up99.4%
metadata-eval99.4%
inv-pow99.4%
+-commutative99.4%
Applied egg-rr99.4%
associate-*l/99.5%
*-lft-identity99.5%
Simplified99.5%
Final simplification99.1%
(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%
sub-neg99.5%
+-commutative99.5%
add-sqr-sqrt99.5%
distribute-rgt-neg-in99.5%
fma-def99.5%
inv-pow99.5%
sqrt-pow299.5%
+-commutative99.5%
metadata-eval99.5%
inv-pow99.5%
sqrt-pow299.5%
+-commutative99.5%
metadata-eval99.5%
pow1/299.5%
pow-flip100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 97.9%
if 0.47999999999999998 < x Initial program 47.2%
frac-sub47.5%
div-inv47.5%
*-un-lft-identity47.5%
+-commutative47.5%
*-rgt-identity47.5%
metadata-eval47.5%
frac-times47.5%
un-div-inv47.5%
pow1/247.5%
pow-flip47.5%
metadata-eval47.5%
+-commutative47.5%
Applied egg-rr47.5%
associate-*r/47.5%
Simplified47.5%
add-sqr-sqrt47.5%
pow-prod-down47.5%
unpow247.5%
*-commutative47.5%
flip--48.3%
associate-*r/48.3%
unpow248.3%
pow-prod-down48.3%
add-sqr-sqrt48.3%
add-sqr-sqrt30.1%
add-sqr-sqrt49.1%
associate--l+99.5%
Applied egg-rr99.5%
associate-/l*99.5%
+-inverses99.5%
metadata-eval99.5%
/-rgt-identity99.5%
+-commutative99.5%
Simplified99.5%
Taylor expanded in x around inf 99.4%
Final simplification98.7%
(FPCore (x) :precision binary64 (if (<= x 0.48) (+ (pow x -0.5) -1.0) (/ (/ 0.5 x) (+ 1.0 (* x 0.5)))))
double code(double x) {
double tmp;
if (x <= 0.48) {
tmp = pow(x, -0.5) + -1.0;
} else {
tmp = (0.5 / x) / (1.0 + (x * 0.5));
}
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) / (1.0d0 + (x * 0.5d0))
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) / (1.0 + (x * 0.5));
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.48: tmp = math.pow(x, -0.5) + -1.0 else: tmp = (0.5 / x) / (1.0 + (x * 0.5)) 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) / Float64(1.0 + Float64(x * 0.5))); 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) / (1.0 + (x * 0.5)); 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[(1.0 + N[(x * 0.5), $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}}{1 + x \cdot 0.5}\\
\end{array}
\end{array}
if x < 0.47999999999999998Initial program 99.5%
sub-neg99.5%
+-commutative99.5%
add-sqr-sqrt99.5%
distribute-rgt-neg-in99.5%
fma-def99.5%
inv-pow99.5%
sqrt-pow299.5%
+-commutative99.5%
metadata-eval99.5%
inv-pow99.5%
sqrt-pow299.5%
+-commutative99.5%
metadata-eval99.5%
pow1/299.5%
pow-flip100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 97.9%
if 0.47999999999999998 < x Initial program 47.2%
frac-sub47.5%
div-inv47.5%
*-un-lft-identity47.5%
+-commutative47.5%
*-rgt-identity47.5%
metadata-eval47.5%
frac-times47.5%
un-div-inv47.5%
pow1/247.5%
pow-flip47.5%
metadata-eval47.5%
+-commutative47.5%
Applied egg-rr47.5%
associate-*r/47.5%
Simplified47.5%
add-sqr-sqrt47.5%
pow-prod-down47.5%
unpow247.5%
*-commutative47.5%
flip--48.3%
associate-*r/48.3%
unpow248.3%
pow-prod-down48.3%
add-sqr-sqrt48.3%
add-sqr-sqrt30.1%
add-sqr-sqrt49.1%
associate--l+99.5%
Applied egg-rr99.5%
associate-/l*99.5%
+-inverses99.5%
metadata-eval99.5%
/-rgt-identity99.5%
+-commutative99.5%
Simplified99.5%
Taylor expanded in x around inf 99.4%
Taylor expanded in x around 0 48.2%
Final simplification72.8%
(FPCore (x) :precision binary64 (if (<= x 0.112) (sqrt (/ 2.0 x)) (/ (/ 0.5 x) (+ 1.0 (* x 0.5)))))
double code(double x) {
double tmp;
if (x <= 0.112) {
tmp = sqrt((2.0 / x));
} else {
tmp = (0.5 / x) / (1.0 + (x * 0.5));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.112d0) then
tmp = sqrt((2.0d0 / x))
else
tmp = (0.5d0 / x) / (1.0d0 + (x * 0.5d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.112) {
tmp = Math.sqrt((2.0 / x));
} else {
tmp = (0.5 / x) / (1.0 + (x * 0.5));
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.112: tmp = math.sqrt((2.0 / x)) else: tmp = (0.5 / x) / (1.0 + (x * 0.5)) return tmp
function code(x) tmp = 0.0 if (x <= 0.112) tmp = sqrt(Float64(2.0 / x)); else tmp = Float64(Float64(0.5 / x) / Float64(1.0 + Float64(x * 0.5))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.112) tmp = sqrt((2.0 / x)); else tmp = (0.5 / x) / (1.0 + (x * 0.5)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.112], N[Sqrt[N[(2.0 / x), $MachinePrecision]], $MachinePrecision], N[(N[(0.5 / x), $MachinePrecision] / N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.112:\\
\;\;\;\;\sqrt{\frac{2}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.5}{x}}{1 + x \cdot 0.5}\\
\end{array}
\end{array}
if x < 0.112000000000000002Initial program 99.5%
frac-sub99.5%
div-inv99.6%
*-un-lft-identity99.6%
+-commutative99.6%
*-rgt-identity99.6%
metadata-eval99.6%
frac-times99.6%
un-div-inv99.6%
pow1/299.6%
pow-flip100.0%
metadata-eval100.0%
+-commutative100.0%
Applied egg-rr100.0%
associate-*r/100.0%
Simplified100.0%
Applied egg-rr93.7%
Taylor expanded in x around inf 20.3%
if 0.112000000000000002 < x Initial program 47.7%
frac-sub47.9%
div-inv47.9%
*-un-lft-identity47.9%
+-commutative47.9%
*-rgt-identity47.9%
metadata-eval47.9%
frac-times47.9%
un-div-inv47.9%
pow1/247.9%
pow-flip47.9%
metadata-eval47.9%
+-commutative47.9%
Applied egg-rr47.9%
associate-*r/47.9%
Simplified47.9%
add-sqr-sqrt47.9%
pow-prod-down47.9%
unpow247.9%
*-commutative47.9%
flip--48.7%
associate-*r/48.7%
unpow248.7%
pow-prod-down48.7%
add-sqr-sqrt48.7%
add-sqr-sqrt30.6%
add-sqr-sqrt49.5%
associate--l+99.5%
Applied egg-rr99.5%
associate-/l*99.5%
+-inverses99.5%
metadata-eval99.5%
/-rgt-identity99.5%
+-commutative99.5%
Simplified99.5%
Taylor expanded in x around inf 98.8%
Taylor expanded in x around 0 48.0%
Final simplification34.4%
(FPCore (x) :precision binary64 (/ (/ 0.5 x) (+ 1.0 (* x 0.5))))
double code(double x) {
return (0.5 / x) / (1.0 + (x * 0.5));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (0.5d0 / x) / (1.0d0 + (x * 0.5d0))
end function
public static double code(double x) {
return (0.5 / x) / (1.0 + (x * 0.5));
}
def code(x): return (0.5 / x) / (1.0 + (x * 0.5))
function code(x) return Float64(Float64(0.5 / x) / Float64(1.0 + Float64(x * 0.5))) end
function tmp = code(x) tmp = (0.5 / x) / (1.0 + (x * 0.5)); end
code[x_] := N[(N[(0.5 / x), $MachinePrecision] / N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{0.5}{x}}{1 + x \cdot 0.5}
\end{array}
Initial program 73.2%
frac-sub73.3%
div-inv73.3%
*-un-lft-identity73.3%
+-commutative73.3%
*-rgt-identity73.3%
metadata-eval73.3%
frac-times73.3%
un-div-inv73.3%
pow1/273.3%
pow-flip73.5%
metadata-eval73.5%
+-commutative73.5%
Applied egg-rr73.5%
associate-*r/73.5%
Simplified73.5%
add-sqr-sqrt73.3%
pow-prod-down73.1%
unpow273.1%
*-commutative73.1%
flip--73.5%
associate-*r/73.5%
unpow273.5%
pow-prod-down73.7%
add-sqr-sqrt73.9%
add-sqr-sqrt64.7%
add-sqr-sqrt74.2%
associate--l+99.6%
Applied egg-rr99.6%
associate-/l*99.6%
+-inverses99.6%
metadata-eval99.6%
/-rgt-identity99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in x around inf 53.6%
Taylor expanded in x around 0 27.8%
Final simplification27.8%
(FPCore (x) :precision binary64 (+ (/ 0.5 x) -0.25))
double code(double x) {
return (0.5 / x) + -0.25;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (0.5d0 / x) + (-0.25d0)
end function
public static double code(double x) {
return (0.5 / x) + -0.25;
}
def code(x): return (0.5 / x) + -0.25
function code(x) return Float64(Float64(0.5 / x) + -0.25) end
function tmp = code(x) tmp = (0.5 / x) + -0.25; end
code[x_] := N[(N[(0.5 / x), $MachinePrecision] + -0.25), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.5}{x} + -0.25
\end{array}
Initial program 73.2%
frac-sub73.3%
div-inv73.3%
*-un-lft-identity73.3%
+-commutative73.3%
*-rgt-identity73.3%
metadata-eval73.3%
frac-times73.3%
un-div-inv73.3%
pow1/273.3%
pow-flip73.5%
metadata-eval73.5%
+-commutative73.5%
Applied egg-rr73.5%
associate-*r/73.5%
Simplified73.5%
add-sqr-sqrt73.3%
pow-prod-down73.1%
unpow273.1%
*-commutative73.1%
flip--73.5%
associate-*r/73.5%
unpow273.5%
pow-prod-down73.7%
add-sqr-sqrt73.9%
add-sqr-sqrt64.7%
add-sqr-sqrt74.2%
associate--l+99.6%
Applied egg-rr99.6%
associate-/l*99.6%
+-inverses99.6%
metadata-eval99.6%
/-rgt-identity99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in x around inf 53.6%
Taylor expanded in x around 0 4.9%
sub-neg4.9%
associate-*r/4.9%
metadata-eval4.9%
metadata-eval4.9%
Simplified4.9%
Final simplification4.9%
(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 2023249
(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)))))