
(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
double code(double x) {
return (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0)));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 / sqrt(x)) - (1.0d0 / sqrt((x + 1.0d0)))
end function
public static double code(double x) {
return (1.0 / Math.sqrt(x)) - (1.0 / Math.sqrt((x + 1.0)));
}
def code(x): return (1.0 / math.sqrt(x)) - (1.0 / math.sqrt((x + 1.0)))
function code(x) return Float64(Float64(1.0 / sqrt(x)) - Float64(1.0 / sqrt(Float64(x + 1.0)))) end
function tmp = code(x) tmp = (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0))); end
code[x_] := N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[(1.0 / N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
double code(double x) {
return (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0)));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 / sqrt(x)) - (1.0d0 / sqrt((x + 1.0d0)))
end function
public static double code(double x) {
return (1.0 / Math.sqrt(x)) - (1.0 / Math.sqrt((x + 1.0)));
}
def code(x): return (1.0 / math.sqrt(x)) - (1.0 / math.sqrt((x + 1.0)))
function code(x) return Float64(Float64(1.0 / sqrt(x)) - Float64(1.0 / sqrt(Float64(x + 1.0)))) end
function tmp = code(x) tmp = (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0))); end
code[x_] := N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[(1.0 / N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\end{array}
(FPCore (x)
:precision binary64
(if (<= (+ (/ 1.0 (sqrt x)) (/ -1.0 (sqrt (+ x 1.0)))) 0.0)
(* (pow x -0.5) (/ 0.5 x))
(*
(pow x -0.5)
(/ (+ 1.0 (* x 0.0)) (+ (+ x 1.0) (sqrt (* x (+ x 1.0))))))))
double code(double x) {
double tmp;
if (((1.0 / sqrt(x)) + (-1.0 / sqrt((x + 1.0)))) <= 0.0) {
tmp = pow(x, -0.5) * (0.5 / x);
} else {
tmp = pow(x, -0.5) * ((1.0 + (x * 0.0)) / ((x + 1.0) + sqrt((x * (x + 1.0)))));
}
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 = (x ** (-0.5d0)) * (0.5d0 / x)
else
tmp = (x ** (-0.5d0)) * ((1.0d0 + (x * 0.0d0)) / ((x + 1.0d0) + sqrt((x * (x + 1.0d0)))))
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 = Math.pow(x, -0.5) * (0.5 / x);
} else {
tmp = Math.pow(x, -0.5) * ((1.0 + (x * 0.0)) / ((x + 1.0) + Math.sqrt((x * (x + 1.0)))));
}
return tmp;
}
def code(x): tmp = 0 if ((1.0 / math.sqrt(x)) + (-1.0 / math.sqrt((x + 1.0)))) <= 0.0: tmp = math.pow(x, -0.5) * (0.5 / x) else: tmp = math.pow(x, -0.5) * ((1.0 + (x * 0.0)) / ((x + 1.0) + math.sqrt((x * (x + 1.0))))) 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((x ^ -0.5) * Float64(0.5 / x)); else tmp = Float64((x ^ -0.5) * Float64(Float64(1.0 + Float64(x * 0.0)) / Float64(Float64(x + 1.0) + sqrt(Float64(x * Float64(x + 1.0)))))); 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 = (x ^ -0.5) * (0.5 / x); else tmp = (x ^ -0.5) * ((1.0 + (x * 0.0)) / ((x + 1.0) + sqrt((x * (x + 1.0))))); 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[(N[Power[x, -0.5], $MachinePrecision] * N[(0.5 / x), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] * N[(N[(1.0 + N[(x * 0.0), $MachinePrecision]), $MachinePrecision] / N[(N[(x + 1.0), $MachinePrecision] + N[Sqrt[N[(x * N[(x + 1.0), $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:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{0.5}{x}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{1 + x \cdot 0}{\left(x + 1\right) + \sqrt{x \cdot \left(x + 1\right)}}\\
\end{array}
\end{array}
if (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) < 0.0Initial program 34.3%
frac-sub34.3%
*-un-lft-identity34.3%
+-commutative34.3%
*-rgt-identity34.3%
sqrt-unprod34.3%
+-commutative34.3%
Applied egg-rr34.3%
flip--34.3%
add-sqr-sqrt34.4%
+-commutative34.4%
add-sqr-sqrt34.3%
+-commutative34.3%
Applied egg-rr34.3%
*-un-lft-identity34.3%
sqrt-prod34.3%
+-commutative34.3%
times-frac34.3%
pow1/234.3%
pow-flip34.3%
metadata-eval34.3%
associate--l+34.3%
Applied egg-rr34.3%
associate-/l/34.3%
+-commutative34.3%
sub-neg34.3%
associate-+l+99.3%
neg-mul-199.3%
*-commutative99.3%
*-rgt-identity99.3%
distribute-lft-out99.3%
metadata-eval99.3%
distribute-rgt-in99.3%
rem-square-sqrt99.4%
+-commutative99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in x around inf 99.6%
if 0.0 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) Initial program 97.8%
frac-sub97.9%
*-un-lft-identity97.9%
+-commutative97.9%
*-rgt-identity97.9%
sqrt-unprod97.9%
+-commutative97.9%
Applied egg-rr97.9%
flip--97.8%
add-sqr-sqrt98.6%
+-commutative98.6%
add-sqr-sqrt99.4%
+-commutative99.4%
Applied egg-rr99.4%
*-un-lft-identity99.4%
sqrt-prod99.4%
+-commutative99.4%
times-frac99.4%
pow1/299.4%
pow-flip99.9%
metadata-eval99.9%
associate--l+99.9%
Applied egg-rr99.9%
associate-/l/99.9%
+-commutative99.9%
sub-neg99.9%
associate-+l+99.9%
neg-mul-199.9%
*-commutative99.9%
*-rgt-identity99.9%
distribute-lft-out99.9%
metadata-eval99.9%
distribute-rgt-in99.9%
rem-square-sqrt99.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
expm1-log1p-u99.9%
expm1-udef99.9%
sqrt-unprod99.9%
+-commutative99.9%
Applied egg-rr99.9%
expm1-def99.9%
expm1-log1p99.9%
Simplified99.9%
Final simplification99.8%
(FPCore (x) :precision binary64 (if (<= (+ (/ 1.0 (sqrt x)) (/ -1.0 (sqrt (+ x 1.0)))) 1e-13) (* (pow x -0.5) (/ (+ 1.0 (* x 0.0)) (+ (* x 2.0) 1.5))) (- (pow x -0.5) (sqrt (/ 1.0 (+ x 1.0))))))
double code(double x) {
double tmp;
if (((1.0 / sqrt(x)) + (-1.0 / sqrt((x + 1.0)))) <= 1e-13) {
tmp = pow(x, -0.5) * ((1.0 + (x * 0.0)) / ((x * 2.0) + 1.5));
} else {
tmp = pow(x, -0.5) - sqrt((1.0 / (x + 1.0)));
}
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)))) <= 1d-13) then
tmp = (x ** (-0.5d0)) * ((1.0d0 + (x * 0.0d0)) / ((x * 2.0d0) + 1.5d0))
else
tmp = (x ** (-0.5d0)) - sqrt((1.0d0 / (x + 1.0d0)))
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)))) <= 1e-13) {
tmp = Math.pow(x, -0.5) * ((1.0 + (x * 0.0)) / ((x * 2.0) + 1.5));
} else {
tmp = Math.pow(x, -0.5) - Math.sqrt((1.0 / (x + 1.0)));
}
return tmp;
}
def code(x): tmp = 0 if ((1.0 / math.sqrt(x)) + (-1.0 / math.sqrt((x + 1.0)))) <= 1e-13: tmp = math.pow(x, -0.5) * ((1.0 + (x * 0.0)) / ((x * 2.0) + 1.5)) else: tmp = math.pow(x, -0.5) - math.sqrt((1.0 / (x + 1.0))) return tmp
function code(x) tmp = 0.0 if (Float64(Float64(1.0 / sqrt(x)) + Float64(-1.0 / sqrt(Float64(x + 1.0)))) <= 1e-13) tmp = Float64((x ^ -0.5) * Float64(Float64(1.0 + Float64(x * 0.0)) / Float64(Float64(x * 2.0) + 1.5))); else tmp = Float64((x ^ -0.5) - sqrt(Float64(1.0 / Float64(x + 1.0)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (((1.0 / sqrt(x)) + (-1.0 / sqrt((x + 1.0)))) <= 1e-13) tmp = (x ^ -0.5) * ((1.0 + (x * 0.0)) / ((x * 2.0) + 1.5)); else tmp = (x ^ -0.5) - sqrt((1.0 / (x + 1.0))); 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], 1e-13], N[(N[Power[x, -0.5], $MachinePrecision] * N[(N[(1.0 + N[(x * 0.0), $MachinePrecision]), $MachinePrecision] / N[(N[(x * 2.0), $MachinePrecision] + 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] - N[Sqrt[N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{\sqrt{x + 1}} \leq 10^{-13}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{1 + x \cdot 0}{x \cdot 2 + 1.5}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} - \sqrt{\frac{1}{x + 1}}\\
\end{array}
\end{array}
if (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) < 1e-13Initial program 34.5%
frac-sub34.6%
*-un-lft-identity34.6%
+-commutative34.6%
*-rgt-identity34.6%
sqrt-unprod34.6%
+-commutative34.6%
Applied egg-rr34.6%
flip--34.6%
add-sqr-sqrt35.3%
+-commutative35.3%
add-sqr-sqrt35.7%
+-commutative35.7%
Applied egg-rr35.7%
*-un-lft-identity35.7%
sqrt-prod35.7%
+-commutative35.7%
times-frac35.7%
pow1/235.7%
pow-flip35.7%
metadata-eval35.7%
associate--l+35.7%
Applied egg-rr35.7%
associate-/l/35.7%
+-commutative35.7%
sub-neg35.7%
associate-+l+99.3%
neg-mul-199.3%
*-commutative99.3%
*-rgt-identity99.3%
distribute-lft-out99.3%
metadata-eval99.3%
distribute-rgt-in99.3%
rem-square-sqrt99.4%
+-commutative99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in x around inf 99.6%
+-commutative99.6%
*-commutative99.6%
Simplified99.6%
if 1e-13 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) Initial program 99.2%
add-sqr-sqrt99.2%
sqrt-unprod99.2%
frac-times99.2%
metadata-eval99.2%
add-sqr-sqrt99.2%
+-commutative99.2%
Applied egg-rr99.2%
expm1-log1p-u89.4%
expm1-udef89.4%
pow1/289.4%
pow-flip89.4%
metadata-eval89.4%
Applied egg-rr91.9%
expm1-def89.4%
expm1-log1p97.0%
Simplified99.7%
Final simplification99.7%
(FPCore (x) :precision binary64 (/ (pow x -0.5) (fma (sqrt x) (sqrt (+ x 1.0)) (+ x 1.0))))
double code(double x) {
return pow(x, -0.5) / fma(sqrt(x), sqrt((x + 1.0)), (x + 1.0));
}
function code(x) return Float64((x ^ -0.5) / fma(sqrt(x), sqrt(Float64(x + 1.0)), Float64(x + 1.0))) end
code[x_] := N[(N[Power[x, -0.5], $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] * N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{x}^{-0.5}}{\mathsf{fma}\left(\sqrt{x}, \sqrt{x + 1}, x + 1\right)}
\end{array}
Initial program 63.6%
frac-sub63.6%
*-un-lft-identity63.6%
+-commutative63.6%
*-rgt-identity63.6%
sqrt-unprod63.6%
+-commutative63.6%
Applied egg-rr63.6%
flip--63.6%
add-sqr-sqrt64.0%
+-commutative64.0%
add-sqr-sqrt64.3%
+-commutative64.3%
Applied egg-rr64.3%
*-un-lft-identity64.3%
sqrt-prod64.3%
+-commutative64.3%
times-frac64.3%
pow1/264.3%
pow-flip64.5%
metadata-eval64.5%
associate--l+64.5%
Applied egg-rr64.5%
associate-/l/64.5%
+-commutative64.5%
sub-neg64.5%
associate-+l+99.6%
neg-mul-199.6%
*-commutative99.6%
*-rgt-identity99.6%
distribute-lft-out99.6%
metadata-eval99.6%
distribute-rgt-in99.6%
rem-square-sqrt99.7%
+-commutative99.7%
+-commutative99.7%
Simplified99.7%
expm1-log1p-u96.2%
expm1-udef60.0%
mul0-rgt60.0%
metadata-eval60.0%
+-commutative60.0%
+-commutative60.0%
fma-def60.0%
+-commutative60.0%
Applied egg-rr60.0%
expm1-def96.3%
expm1-log1p99.8%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x) :precision binary64 (* (pow x -0.5) (/ (+ 1.0 (* x 0.0)) (+ (+ x 1.0) (* (sqrt x) (sqrt (+ x 1.0)))))))
double code(double x) {
return pow(x, -0.5) * ((1.0 + (x * 0.0)) / ((x + 1.0) + (sqrt(x) * sqrt((x + 1.0)))));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (x ** (-0.5d0)) * ((1.0d0 + (x * 0.0d0)) / ((x + 1.0d0) + (sqrt(x) * sqrt((x + 1.0d0)))))
end function
public static double code(double x) {
return Math.pow(x, -0.5) * ((1.0 + (x * 0.0)) / ((x + 1.0) + (Math.sqrt(x) * Math.sqrt((x + 1.0)))));
}
def code(x): return math.pow(x, -0.5) * ((1.0 + (x * 0.0)) / ((x + 1.0) + (math.sqrt(x) * math.sqrt((x + 1.0)))))
function code(x) return Float64((x ^ -0.5) * Float64(Float64(1.0 + Float64(x * 0.0)) / Float64(Float64(x + 1.0) + Float64(sqrt(x) * sqrt(Float64(x + 1.0)))))) end
function tmp = code(x) tmp = (x ^ -0.5) * ((1.0 + (x * 0.0)) / ((x + 1.0) + (sqrt(x) * sqrt((x + 1.0))))); end
code[x_] := N[(N[Power[x, -0.5], $MachinePrecision] * N[(N[(1.0 + N[(x * 0.0), $MachinePrecision]), $MachinePrecision] / N[(N[(x + 1.0), $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] * N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{x}^{-0.5} \cdot \frac{1 + x \cdot 0}{\left(x + 1\right) + \sqrt{x} \cdot \sqrt{x + 1}}
\end{array}
Initial program 63.6%
frac-sub63.6%
*-un-lft-identity63.6%
+-commutative63.6%
*-rgt-identity63.6%
sqrt-unprod63.6%
+-commutative63.6%
Applied egg-rr63.6%
flip--63.6%
add-sqr-sqrt64.0%
+-commutative64.0%
add-sqr-sqrt64.3%
+-commutative64.3%
Applied egg-rr64.3%
*-un-lft-identity64.3%
sqrt-prod64.3%
+-commutative64.3%
times-frac64.3%
pow1/264.3%
pow-flip64.5%
metadata-eval64.5%
associate--l+64.5%
Applied egg-rr64.5%
associate-/l/64.5%
+-commutative64.5%
sub-neg64.5%
associate-+l+99.6%
neg-mul-199.6%
*-commutative99.6%
*-rgt-identity99.6%
distribute-lft-out99.6%
metadata-eval99.6%
distribute-rgt-in99.6%
rem-square-sqrt99.7%
+-commutative99.7%
+-commutative99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x) :precision binary64 (if (<= x 84000.0) (- (pow x -0.5) (pow (+ x 1.0) -0.5)) (* (pow x -0.5) (/ (+ 1.0 (* x 0.0)) (+ (* x 2.0) 1.5)))))
double code(double x) {
double tmp;
if (x <= 84000.0) {
tmp = pow(x, -0.5) - pow((x + 1.0), -0.5);
} else {
tmp = pow(x, -0.5) * ((1.0 + (x * 0.0)) / ((x * 2.0) + 1.5));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 84000.0d0) then
tmp = (x ** (-0.5d0)) - ((x + 1.0d0) ** (-0.5d0))
else
tmp = (x ** (-0.5d0)) * ((1.0d0 + (x * 0.0d0)) / ((x * 2.0d0) + 1.5d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 84000.0) {
tmp = Math.pow(x, -0.5) - Math.pow((x + 1.0), -0.5);
} else {
tmp = Math.pow(x, -0.5) * ((1.0 + (x * 0.0)) / ((x * 2.0) + 1.5));
}
return tmp;
}
def code(x): tmp = 0 if x <= 84000.0: tmp = math.pow(x, -0.5) - math.pow((x + 1.0), -0.5) else: tmp = math.pow(x, -0.5) * ((1.0 + (x * 0.0)) / ((x * 2.0) + 1.5)) return tmp
function code(x) tmp = 0.0 if (x <= 84000.0) tmp = Float64((x ^ -0.5) - (Float64(x + 1.0) ^ -0.5)); else tmp = Float64((x ^ -0.5) * Float64(Float64(1.0 + Float64(x * 0.0)) / Float64(Float64(x * 2.0) + 1.5))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 84000.0) tmp = (x ^ -0.5) - ((x + 1.0) ^ -0.5); else tmp = (x ^ -0.5) * ((1.0 + (x * 0.0)) / ((x * 2.0) + 1.5)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 84000.0], N[(N[Power[x, -0.5], $MachinePrecision] - N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] * N[(N[(1.0 + N[(x * 0.0), $MachinePrecision]), $MachinePrecision] / N[(N[(x * 2.0), $MachinePrecision] + 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 84000:\\
\;\;\;\;{x}^{-0.5} - {\left(x + 1\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{1 + x \cdot 0}{x \cdot 2 + 1.5}\\
\end{array}
\end{array}
if x < 84000Initial program 99.2%
*-un-lft-identity99.2%
clear-num99.2%
associate-/r/99.2%
prod-diff99.2%
*-un-lft-identity99.2%
fma-neg99.2%
*-un-lft-identity99.2%
pow1/299.2%
pow-flip99.7%
metadata-eval99.7%
pow1/299.7%
pow-flip99.7%
+-commutative99.7%
metadata-eval99.7%
Applied egg-rr99.7%
+-commutative99.7%
sub-neg99.7%
fma-udef99.7%
distribute-lft1-in99.7%
metadata-eval99.7%
mul0-lft99.7%
+-commutative99.7%
associate-+r+99.7%
sub-neg99.7%
neg-sub099.7%
+-commutative99.7%
sub-neg99.7%
Simplified99.7%
if 84000 < x Initial program 34.5%
frac-sub34.6%
*-un-lft-identity34.6%
+-commutative34.6%
*-rgt-identity34.6%
sqrt-unprod34.6%
+-commutative34.6%
Applied egg-rr34.6%
flip--34.6%
add-sqr-sqrt35.3%
+-commutative35.3%
add-sqr-sqrt35.7%
+-commutative35.7%
Applied egg-rr35.7%
*-un-lft-identity35.7%
sqrt-prod35.7%
+-commutative35.7%
times-frac35.7%
pow1/235.7%
pow-flip35.7%
metadata-eval35.7%
associate--l+35.7%
Applied egg-rr35.7%
associate-/l/35.7%
+-commutative35.7%
sub-neg35.7%
associate-+l+99.3%
neg-mul-199.3%
*-commutative99.3%
*-rgt-identity99.3%
distribute-lft-out99.3%
metadata-eval99.3%
distribute-rgt-in99.3%
rem-square-sqrt99.4%
+-commutative99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in x around inf 99.6%
+-commutative99.6%
*-commutative99.6%
Simplified99.6%
Final simplification99.7%
(FPCore (x) :precision binary64 (if (<= x 0.5) (+ (pow x -0.5) (- -1.0 (* x (+ -0.5 (* x 0.375))))) (* (pow x -0.5) (/ (+ 1.0 (* x 0.0)) (+ 1.5 (- (* x 2.0) (/ 0.125 x)))))))
double code(double x) {
double tmp;
if (x <= 0.5) {
tmp = pow(x, -0.5) + (-1.0 - (x * (-0.5 + (x * 0.375))));
} else {
tmp = pow(x, -0.5) * ((1.0 + (x * 0.0)) / (1.5 + ((x * 2.0) - (0.125 / x))));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.5d0) then
tmp = (x ** (-0.5d0)) + ((-1.0d0) - (x * ((-0.5d0) + (x * 0.375d0))))
else
tmp = (x ** (-0.5d0)) * ((1.0d0 + (x * 0.0d0)) / (1.5d0 + ((x * 2.0d0) - (0.125d0 / x))))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.5) {
tmp = Math.pow(x, -0.5) + (-1.0 - (x * (-0.5 + (x * 0.375))));
} else {
tmp = Math.pow(x, -0.5) * ((1.0 + (x * 0.0)) / (1.5 + ((x * 2.0) - (0.125 / x))));
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.5: tmp = math.pow(x, -0.5) + (-1.0 - (x * (-0.5 + (x * 0.375)))) else: tmp = math.pow(x, -0.5) * ((1.0 + (x * 0.0)) / (1.5 + ((x * 2.0) - (0.125 / x)))) return tmp
function code(x) tmp = 0.0 if (x <= 0.5) tmp = Float64((x ^ -0.5) + Float64(-1.0 - Float64(x * Float64(-0.5 + Float64(x * 0.375))))); else tmp = Float64((x ^ -0.5) * Float64(Float64(1.0 + Float64(x * 0.0)) / Float64(1.5 + Float64(Float64(x * 2.0) - Float64(0.125 / x))))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.5) tmp = (x ^ -0.5) + (-1.0 - (x * (-0.5 + (x * 0.375)))); else tmp = (x ^ -0.5) * ((1.0 + (x * 0.0)) / (1.5 + ((x * 2.0) - (0.125 / x)))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.5], N[(N[Power[x, -0.5], $MachinePrecision] + N[(-1.0 - N[(x * N[(-0.5 + N[(x * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] * N[(N[(1.0 + N[(x * 0.0), $MachinePrecision]), $MachinePrecision] / N[(1.5 + N[(N[(x * 2.0), $MachinePrecision] - N[(0.125 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.5:\\
\;\;\;\;{x}^{-0.5} + \left(-1 - x \cdot \left(-0.5 + x \cdot 0.375\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{1 + x \cdot 0}{1.5 + \left(x \cdot 2 - \frac{0.125}{x}\right)}\\
\end{array}
\end{array}
if x < 0.5Initial program 99.5%
Taylor expanded in x around 0 99.1%
*-commutative99.1%
*-commutative99.1%
unpow299.1%
associate-*l*99.1%
distribute-lft-out99.1%
Simplified99.1%
expm1-log1p-u91.8%
expm1-udef91.8%
pow1/291.8%
pow-flip91.8%
metadata-eval91.8%
Applied egg-rr91.8%
expm1-def91.8%
expm1-log1p99.6%
Simplified99.6%
if 0.5 < x Initial program 35.6%
frac-sub35.7%
*-un-lft-identity35.7%
+-commutative35.7%
*-rgt-identity35.7%
sqrt-unprod35.7%
+-commutative35.7%
Applied egg-rr35.7%
flip--35.7%
add-sqr-sqrt36.4%
+-commutative36.4%
add-sqr-sqrt37.0%
+-commutative37.0%
Applied egg-rr37.0%
*-un-lft-identity37.0%
sqrt-prod37.0%
+-commutative37.0%
times-frac37.0%
pow1/237.0%
pow-flip37.0%
metadata-eval37.0%
associate--l+37.0%
Applied egg-rr37.0%
associate-/l/37.0%
+-commutative37.0%
sub-neg37.0%
associate-+l+99.3%
neg-mul-199.3%
*-commutative99.3%
*-rgt-identity99.3%
distribute-lft-out99.3%
metadata-eval99.3%
distribute-rgt-in99.3%
rem-square-sqrt99.4%
+-commutative99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in x around inf 98.8%
associate--l+98.8%
*-commutative98.8%
associate-*r/98.8%
metadata-eval98.8%
Simplified98.8%
Final simplification99.2%
(FPCore (x) :precision binary64 (if (<= x 0.5) (+ (pow x -0.5) (- -1.0 (* x (+ -0.5 (* x 0.375))))) (* (pow x -0.5) (/ (+ 1.0 (* x 0.0)) (+ (* x 2.0) 1.5)))))
double code(double x) {
double tmp;
if (x <= 0.5) {
tmp = pow(x, -0.5) + (-1.0 - (x * (-0.5 + (x * 0.375))));
} else {
tmp = pow(x, -0.5) * ((1.0 + (x * 0.0)) / ((x * 2.0) + 1.5));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.5d0) then
tmp = (x ** (-0.5d0)) + ((-1.0d0) - (x * ((-0.5d0) + (x * 0.375d0))))
else
tmp = (x ** (-0.5d0)) * ((1.0d0 + (x * 0.0d0)) / ((x * 2.0d0) + 1.5d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.5) {
tmp = Math.pow(x, -0.5) + (-1.0 - (x * (-0.5 + (x * 0.375))));
} else {
tmp = Math.pow(x, -0.5) * ((1.0 + (x * 0.0)) / ((x * 2.0) + 1.5));
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.5: tmp = math.pow(x, -0.5) + (-1.0 - (x * (-0.5 + (x * 0.375)))) else: tmp = math.pow(x, -0.5) * ((1.0 + (x * 0.0)) / ((x * 2.0) + 1.5)) return tmp
function code(x) tmp = 0.0 if (x <= 0.5) tmp = Float64((x ^ -0.5) + Float64(-1.0 - Float64(x * Float64(-0.5 + Float64(x * 0.375))))); else tmp = Float64((x ^ -0.5) * Float64(Float64(1.0 + Float64(x * 0.0)) / Float64(Float64(x * 2.0) + 1.5))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.5) tmp = (x ^ -0.5) + (-1.0 - (x * (-0.5 + (x * 0.375)))); else tmp = (x ^ -0.5) * ((1.0 + (x * 0.0)) / ((x * 2.0) + 1.5)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.5], N[(N[Power[x, -0.5], $MachinePrecision] + N[(-1.0 - N[(x * N[(-0.5 + N[(x * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] * N[(N[(1.0 + N[(x * 0.0), $MachinePrecision]), $MachinePrecision] / N[(N[(x * 2.0), $MachinePrecision] + 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.5:\\
\;\;\;\;{x}^{-0.5} + \left(-1 - x \cdot \left(-0.5 + x \cdot 0.375\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{1 + x \cdot 0}{x \cdot 2 + 1.5}\\
\end{array}
\end{array}
if x < 0.5Initial program 99.5%
Taylor expanded in x around 0 99.1%
*-commutative99.1%
*-commutative99.1%
unpow299.1%
associate-*l*99.1%
distribute-lft-out99.1%
Simplified99.1%
expm1-log1p-u91.8%
expm1-udef91.8%
pow1/291.8%
pow-flip91.8%
metadata-eval91.8%
Applied egg-rr91.8%
expm1-def91.8%
expm1-log1p99.6%
Simplified99.6%
if 0.5 < x Initial program 35.6%
frac-sub35.7%
*-un-lft-identity35.7%
+-commutative35.7%
*-rgt-identity35.7%
sqrt-unprod35.7%
+-commutative35.7%
Applied egg-rr35.7%
flip--35.7%
add-sqr-sqrt36.4%
+-commutative36.4%
add-sqr-sqrt37.0%
+-commutative37.0%
Applied egg-rr37.0%
*-un-lft-identity37.0%
sqrt-prod37.0%
+-commutative37.0%
times-frac37.0%
pow1/237.0%
pow-flip37.0%
metadata-eval37.0%
associate--l+37.0%
Applied egg-rr37.0%
associate-/l/37.0%
+-commutative37.0%
sub-neg37.0%
associate-+l+99.3%
neg-mul-199.3%
*-commutative99.3%
*-rgt-identity99.3%
distribute-lft-out99.3%
metadata-eval99.3%
distribute-rgt-in99.3%
rem-square-sqrt99.4%
+-commutative99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in x around inf 98.6%
+-commutative98.6%
*-commutative98.6%
Simplified98.6%
Final simplification99.0%
(FPCore (x) :precision binary64 (if (<= x 0.95) (+ (pow x -0.5) (- -1.0 (* x (+ -0.5 (* x 0.375))))) (* (pow x -0.5) (/ 0.5 x))))
double code(double x) {
double tmp;
if (x <= 0.95) {
tmp = pow(x, -0.5) + (-1.0 - (x * (-0.5 + (x * 0.375))));
} 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.95d0) then
tmp = (x ** (-0.5d0)) + ((-1.0d0) - (x * ((-0.5d0) + (x * 0.375d0))))
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.95) {
tmp = Math.pow(x, -0.5) + (-1.0 - (x * (-0.5 + (x * 0.375))));
} else {
tmp = Math.pow(x, -0.5) * (0.5 / x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.95: tmp = math.pow(x, -0.5) + (-1.0 - (x * (-0.5 + (x * 0.375)))) else: tmp = math.pow(x, -0.5) * (0.5 / x) return tmp
function code(x) tmp = 0.0 if (x <= 0.95) tmp = Float64((x ^ -0.5) + Float64(-1.0 - Float64(x * Float64(-0.5 + Float64(x * 0.375))))); 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.95) tmp = (x ^ -0.5) + (-1.0 - (x * (-0.5 + (x * 0.375)))); else tmp = (x ^ -0.5) * (0.5 / x); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.95], N[(N[Power[x, -0.5], $MachinePrecision] + N[(-1.0 - N[(x * N[(-0.5 + N[(x * 0.375), $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 0.95:\\
\;\;\;\;{x}^{-0.5} + \left(-1 - x \cdot \left(-0.5 + x \cdot 0.375\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{0.5}{x}\\
\end{array}
\end{array}
if x < 0.94999999999999996Initial program 99.5%
Taylor expanded in x around 0 99.1%
*-commutative99.1%
*-commutative99.1%
unpow299.1%
associate-*l*99.1%
distribute-lft-out99.1%
Simplified99.1%
expm1-log1p-u91.8%
expm1-udef91.8%
pow1/291.8%
pow-flip91.8%
metadata-eval91.8%
Applied egg-rr91.8%
expm1-def91.8%
expm1-log1p99.6%
Simplified99.6%
if 0.94999999999999996 < x Initial program 35.6%
frac-sub35.7%
*-un-lft-identity35.7%
+-commutative35.7%
*-rgt-identity35.7%
sqrt-unprod35.7%
+-commutative35.7%
Applied egg-rr35.7%
flip--35.7%
add-sqr-sqrt36.4%
+-commutative36.4%
add-sqr-sqrt37.0%
+-commutative37.0%
Applied egg-rr37.0%
*-un-lft-identity37.0%
sqrt-prod37.0%
+-commutative37.0%
times-frac37.0%
pow1/237.0%
pow-flip37.0%
metadata-eval37.0%
associate--l+37.0%
Applied egg-rr37.0%
associate-/l/37.0%
+-commutative37.0%
sub-neg37.0%
associate-+l+99.3%
neg-mul-199.3%
*-commutative99.3%
*-rgt-identity99.3%
distribute-lft-out99.3%
metadata-eval99.3%
distribute-rgt-in99.3%
rem-square-sqrt99.4%
+-commutative99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in x around inf 97.6%
Final simplification98.5%
(FPCore (x) :precision binary64 (if (<= x 1.0) (+ (+ (pow x -0.5) (* x 0.5)) -1.0) (* (pow x -0.5) (/ 0.5 x))))
double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = (pow(x, -0.5) + (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 <= 1.0d0) then
tmp = ((x ** (-0.5d0)) + (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 <= 1.0) {
tmp = (Math.pow(x, -0.5) + (x * 0.5)) + -1.0;
} else {
tmp = Math.pow(x, -0.5) * (0.5 / x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.0: tmp = (math.pow(x, -0.5) + (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 <= 1.0) tmp = Float64(Float64((x ^ -0.5) + 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 <= 1.0) tmp = ((x ^ -0.5) + (x * 0.5)) + -1.0; else tmp = (x ^ -0.5) * (0.5 / x); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.0], N[(N[(N[Power[x, -0.5], $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] * N[(0.5 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\left({x}^{-0.5} + x \cdot 0.5\right) + -1\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{0.5}{x}\\
\end{array}
\end{array}
if x < 1Initial 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%
pow1/299.5%
pow-flip100.0%
metadata-eval100.0%
pow1/2100.0%
pow-flip100.0%
+-commutative100.0%
metadata-eval100.0%
Applied egg-rr100.0%
+-commutative100.0%
sub-neg100.0%
fma-udef100.0%
distribute-lft1-in100.0%
metadata-eval100.0%
mul0-lft100.0%
+-commutative100.0%
associate-+r+100.0%
sub-neg100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 99.5%
if 1 < x Initial program 35.6%
frac-sub35.7%
*-un-lft-identity35.7%
+-commutative35.7%
*-rgt-identity35.7%
sqrt-unprod35.7%
+-commutative35.7%
Applied egg-rr35.7%
flip--35.7%
add-sqr-sqrt36.4%
+-commutative36.4%
add-sqr-sqrt37.0%
+-commutative37.0%
Applied egg-rr37.0%
*-un-lft-identity37.0%
sqrt-prod37.0%
+-commutative37.0%
times-frac37.0%
pow1/237.0%
pow-flip37.0%
metadata-eval37.0%
associate--l+37.0%
Applied egg-rr37.0%
associate-/l/37.0%
+-commutative37.0%
sub-neg37.0%
associate-+l+99.3%
neg-mul-199.3%
*-commutative99.3%
*-rgt-identity99.3%
distribute-lft-out99.3%
metadata-eval99.3%
distribute-rgt-in99.3%
rem-square-sqrt99.4%
+-commutative99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in x around inf 97.6%
Final simplification98.4%
(FPCore (x) :precision binary64 (if (<= x 0.66) (+ (pow x -0.5) -1.0) (* (pow x -0.5) (/ 0.5 x))))
double code(double x) {
double tmp;
if (x <= 0.66) {
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.66d0) 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.66) {
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.66: 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.66) 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.66) 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.66], 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.66:\\
\;\;\;\;{x}^{-0.5} + -1\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{0.5}{x}\\
\end{array}
\end{array}
if x < 0.660000000000000031Initial 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%
pow1/299.5%
pow-flip100.0%
metadata-eval100.0%
pow1/2100.0%
pow-flip100.0%
+-commutative100.0%
metadata-eval100.0%
Applied egg-rr100.0%
+-commutative100.0%
sub-neg100.0%
fma-udef100.0%
distribute-lft1-in100.0%
metadata-eval100.0%
mul0-lft100.0%
+-commutative100.0%
associate-+r+100.0%
sub-neg100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 99.2%
if 0.660000000000000031 < x Initial program 35.6%
frac-sub35.7%
*-un-lft-identity35.7%
+-commutative35.7%
*-rgt-identity35.7%
sqrt-unprod35.7%
+-commutative35.7%
Applied egg-rr35.7%
flip--35.7%
add-sqr-sqrt36.4%
+-commutative36.4%
add-sqr-sqrt37.0%
+-commutative37.0%
Applied egg-rr37.0%
*-un-lft-identity37.0%
sqrt-prod37.0%
+-commutative37.0%
times-frac37.0%
pow1/237.0%
pow-flip37.0%
metadata-eval37.0%
associate--l+37.0%
Applied egg-rr37.0%
associate-/l/37.0%
+-commutative37.0%
sub-neg37.0%
associate-+l+99.3%
neg-mul-199.3%
*-commutative99.3%
*-rgt-identity99.3%
distribute-lft-out99.3%
metadata-eval99.3%
distribute-rgt-in99.3%
rem-square-sqrt99.4%
+-commutative99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in x around inf 97.6%
Final simplification98.3%
(FPCore (x) :precision binary64 (+ (pow x -0.5) -1.0))
double code(double x) {
return pow(x, -0.5) + -1.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (x ** (-0.5d0)) + (-1.0d0)
end function
public static double code(double x) {
return Math.pow(x, -0.5) + -1.0;
}
def code(x): return math.pow(x, -0.5) + -1.0
function code(x) return Float64((x ^ -0.5) + -1.0) end
function tmp = code(x) tmp = (x ^ -0.5) + -1.0; end
code[x_] := N[(N[Power[x, -0.5], $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}
\\
{x}^{-0.5} + -1
\end{array}
Initial program 63.6%
*-un-lft-identity63.6%
clear-num63.6%
associate-/r/63.6%
prod-diff63.6%
*-un-lft-identity63.6%
fma-neg63.6%
*-un-lft-identity63.6%
pow1/263.6%
pow-flip60.6%
metadata-eval60.6%
pow1/260.6%
pow-flip63.8%
+-commutative63.8%
metadata-eval63.8%
Applied egg-rr63.8%
+-commutative63.8%
sub-neg63.8%
fma-udef63.8%
distribute-lft1-in63.8%
metadata-eval63.8%
mul0-lft63.8%
+-commutative63.8%
associate-+r+63.8%
sub-neg63.8%
neg-sub063.8%
+-commutative63.8%
sub-neg63.8%
Simplified63.8%
Taylor expanded in x around 0 44.9%
Final simplification44.9%
(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 63.6%
Taylor expanded in x around 0 44.6%
Taylor expanded in x around inf 2.0%
Final simplification2.0%
(FPCore (x) :precision binary64 2.0)
double code(double x) {
return 2.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = 2.0d0
end function
public static double code(double x) {
return 2.0;
}
def code(x): return 2.0
function code(x) return 2.0 end
function tmp = code(x) tmp = 2.0; end
code[x_] := 2.0
\begin{array}{l}
\\
2
\end{array}
Initial program 63.6%
frac-sub63.6%
*-un-lft-identity63.6%
+-commutative63.6%
*-rgt-identity63.6%
sqrt-unprod63.6%
+-commutative63.6%
Applied egg-rr63.6%
flip--63.6%
add-sqr-sqrt64.0%
+-commutative64.0%
add-sqr-sqrt64.3%
+-commutative64.3%
Applied egg-rr64.3%
Taylor expanded in x around inf 23.2%
+-commutative23.2%
Simplified23.2%
Taylor expanded in x around 0 5.5%
Final simplification5.5%
(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 2024011
(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)))))