
(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 (* (pow x -0.5) (/ (pow x -0.5) (fma (pow x -0.5) (+ x 1.0) (sqrt (+ x 1.0))))))
double code(double x) {
return pow(x, -0.5) * (pow(x, -0.5) / fma(pow(x, -0.5), (x + 1.0), sqrt((x + 1.0))));
}
function code(x) return Float64((x ^ -0.5) * Float64((x ^ -0.5) / fma((x ^ -0.5), Float64(x + 1.0), sqrt(Float64(x + 1.0))))) end
code[x_] := N[(N[Power[x, -0.5], $MachinePrecision] * N[(N[Power[x, -0.5], $MachinePrecision] / N[(N[Power[x, -0.5], $MachinePrecision] * N[(x + 1.0), $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{x}^{-0.5} \cdot \frac{{x}^{-0.5}}{\mathsf{fma}\left({x}^{-0.5}, x + 1, \sqrt{x + 1}\right)}
\end{array}
Initial program 67.9%
add-exp-log52.0%
inv-pow52.0%
pow1/252.0%
pow-pow52.0%
log-pow52.0%
metadata-eval52.0%
+-commutative52.0%
log1p-udef52.0%
Applied egg-rr52.0%
exp-prod52.3%
Simplified52.3%
expm1-log1p-u52.3%
expm1-udef51.9%
add-exp-log51.9%
log-pow51.9%
log1p-udef51.9%
add-log-exp51.9%
pow-to-exp51.9%
+-commutative51.9%
Applied egg-rr51.9%
expm1-def63.1%
expm1-log1p63.1%
Simplified63.1%
flip--63.1%
frac-times56.1%
metadata-eval56.1%
add-sqr-sqrt58.2%
pow-prod-up67.7%
metadata-eval67.7%
inv-pow67.7%
pow1/267.7%
pow-flip67.7%
metadata-eval67.7%
un-div-inv67.6%
frac-sub68.7%
*-un-lft-identity68.7%
Applied egg-rr68.8%
associate-/r*68.8%
associate-/r/68.8%
*-commutative68.8%
associate-*r/68.8%
*-rgt-identity68.8%
associate-/r*68.8%
*-rgt-identity68.8%
associate-/l*68.8%
/-rgt-identity68.8%
*-commutative68.8%
fma-udef68.8%
distribute-lft1-in68.8%
*-commutative68.8%
*-commutative68.8%
associate-*r*68.8%
associate-/l/68.8%
Simplified99.4%
mul0-rgt99.4%
metadata-eval99.4%
inv-pow99.4%
metadata-eval99.4%
pow-sqr99.6%
*-un-lft-identity99.6%
times-frac99.6%
unpow1/299.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (x) :precision binary64 (/ (/ 1.0 x) (fma (pow x -0.5) (+ x 1.0) (sqrt (+ x 1.0)))))
double code(double x) {
return (1.0 / x) / fma(pow(x, -0.5), (x + 1.0), sqrt((x + 1.0)));
}
function code(x) return Float64(Float64(1.0 / x) / fma((x ^ -0.5), Float64(x + 1.0), sqrt(Float64(x + 1.0)))) end
code[x_] := N[(N[(1.0 / x), $MachinePrecision] / N[(N[Power[x, -0.5], $MachinePrecision] * N[(x + 1.0), $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{\mathsf{fma}\left({x}^{-0.5}, x + 1, \sqrt{x + 1}\right)}
\end{array}
Initial program 67.9%
add-exp-log52.0%
inv-pow52.0%
pow1/252.0%
pow-pow52.0%
log-pow52.0%
metadata-eval52.0%
+-commutative52.0%
log1p-udef52.0%
Applied egg-rr52.0%
exp-prod52.3%
Simplified52.3%
expm1-log1p-u52.3%
expm1-udef51.9%
add-exp-log51.9%
log-pow51.9%
log1p-udef51.9%
add-log-exp51.9%
pow-to-exp51.9%
+-commutative51.9%
Applied egg-rr51.9%
expm1-def63.1%
expm1-log1p63.1%
Simplified63.1%
flip--63.1%
frac-times56.1%
metadata-eval56.1%
add-sqr-sqrt58.2%
pow-prod-up67.7%
metadata-eval67.7%
inv-pow67.7%
pow1/267.7%
pow-flip67.7%
metadata-eval67.7%
un-div-inv67.6%
frac-sub68.7%
*-un-lft-identity68.7%
Applied egg-rr68.8%
associate-/r*68.8%
associate-/r/68.8%
*-commutative68.8%
associate-*r/68.8%
*-rgt-identity68.8%
associate-/r*68.8%
*-rgt-identity68.8%
associate-/l*68.8%
/-rgt-identity68.8%
*-commutative68.8%
fma-udef68.8%
distribute-lft1-in68.8%
*-commutative68.8%
*-commutative68.8%
associate-*r*68.8%
associate-/l/68.8%
Simplified99.4%
expm1-log1p-u96.1%
expm1-udef63.9%
clear-num63.9%
mul0-rgt63.9%
metadata-eval63.9%
div-inv63.9%
unpow1/263.9%
clear-num63.9%
/-rgt-identity63.9%
Applied egg-rr63.9%
expm1-def95.5%
expm1-log1p98.7%
*-commutative98.7%
associate-/r*99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (x) :precision binary64 (/ (/ (+ 1.0 (* x 0.0)) x) (+ (sqrt (+ x 1.0)) (* (pow x -0.5) (+ x 1.0)))))
double code(double x) {
return ((1.0 + (x * 0.0)) / x) / (sqrt((x + 1.0)) + (pow(x, -0.5) * (x + 1.0)));
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((1.0d0 + (x * 0.0d0)) / x) / (sqrt((x + 1.0d0)) + ((x ** (-0.5d0)) * (x + 1.0d0)))
end function
public static double code(double x) {
return ((1.0 + (x * 0.0)) / x) / (Math.sqrt((x + 1.0)) + (Math.pow(x, -0.5) * (x + 1.0)));
}
def code(x): return ((1.0 + (x * 0.0)) / x) / (math.sqrt((x + 1.0)) + (math.pow(x, -0.5) * (x + 1.0)))
function code(x) return Float64(Float64(Float64(1.0 + Float64(x * 0.0)) / x) / Float64(sqrt(Float64(x + 1.0)) + Float64((x ^ -0.5) * Float64(x + 1.0)))) end
function tmp = code(x) tmp = ((1.0 + (x * 0.0)) / x) / (sqrt((x + 1.0)) + ((x ^ -0.5) * (x + 1.0))); end
code[x_] := N[(N[(N[(1.0 + N[(x * 0.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[Power[x, -0.5], $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1 + x \cdot 0}{x}}{\sqrt{x + 1} + {x}^{-0.5} \cdot \left(x + 1\right)}
\end{array}
Initial program 67.9%
add-exp-log52.0%
inv-pow52.0%
pow1/252.0%
pow-pow52.0%
log-pow52.0%
metadata-eval52.0%
+-commutative52.0%
log1p-udef52.0%
Applied egg-rr52.0%
exp-prod52.3%
Simplified52.3%
expm1-log1p-u52.3%
expm1-udef51.9%
add-exp-log51.9%
log-pow51.9%
log1p-udef51.9%
add-log-exp51.9%
pow-to-exp51.9%
+-commutative51.9%
Applied egg-rr51.9%
expm1-def63.1%
expm1-log1p63.1%
Simplified63.1%
flip--63.1%
frac-times56.1%
metadata-eval56.1%
add-sqr-sqrt58.2%
pow-prod-up67.7%
metadata-eval67.7%
inv-pow67.7%
pow1/267.7%
pow-flip67.7%
metadata-eval67.7%
un-div-inv67.6%
frac-sub68.7%
*-un-lft-identity68.7%
Applied egg-rr68.8%
associate-/r*68.8%
associate-/r/68.8%
*-commutative68.8%
associate-*r/68.8%
*-rgt-identity68.8%
associate-/r*68.8%
*-rgt-identity68.8%
associate-/l*68.8%
/-rgt-identity68.8%
*-commutative68.8%
fma-udef68.8%
distribute-lft1-in68.8%
*-commutative68.8%
*-commutative68.8%
associate-*r*68.8%
associate-/l/68.8%
Simplified99.4%
fma-udef99.4%
unpow1/299.4%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (x)
:precision binary64
(let* ((t_0 (sqrt (+ x 1.0))))
(if (<= x 80000000.0)
(+ (pow x -0.5) (/ -1.0 t_0))
(/ (/ 1.0 (* x x)) (+ (pow x -0.5) (/ 1.0 t_0))))))
double code(double x) {
double t_0 = sqrt((x + 1.0));
double tmp;
if (x <= 80000000.0) {
tmp = pow(x, -0.5) + (-1.0 / t_0);
} else {
tmp = (1.0 / (x * x)) / (pow(x, -0.5) + (1.0 / t_0));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((x + 1.0d0))
if (x <= 80000000.0d0) then
tmp = (x ** (-0.5d0)) + ((-1.0d0) / t_0)
else
tmp = (1.0d0 / (x * x)) / ((x ** (-0.5d0)) + (1.0d0 / t_0))
end if
code = tmp
end function
public static double code(double x) {
double t_0 = Math.sqrt((x + 1.0));
double tmp;
if (x <= 80000000.0) {
tmp = Math.pow(x, -0.5) + (-1.0 / t_0);
} else {
tmp = (1.0 / (x * x)) / (Math.pow(x, -0.5) + (1.0 / t_0));
}
return tmp;
}
def code(x): t_0 = math.sqrt((x + 1.0)) tmp = 0 if x <= 80000000.0: tmp = math.pow(x, -0.5) + (-1.0 / t_0) else: tmp = (1.0 / (x * x)) / (math.pow(x, -0.5) + (1.0 / t_0)) return tmp
function code(x) t_0 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (x <= 80000000.0) tmp = Float64((x ^ -0.5) + Float64(-1.0 / t_0)); else tmp = Float64(Float64(1.0 / Float64(x * x)) / Float64((x ^ -0.5) + Float64(1.0 / t_0))); end return tmp end
function tmp_2 = code(x) t_0 = sqrt((x + 1.0)); tmp = 0.0; if (x <= 80000000.0) tmp = (x ^ -0.5) + (-1.0 / t_0); else tmp = (1.0 / (x * x)) / ((x ^ -0.5) + (1.0 / t_0)); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 80000000.0], N[(N[Power[x, -0.5], $MachinePrecision] + N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(N[Power[x, -0.5], $MachinePrecision] + N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{x + 1}\\
\mathbf{if}\;x \leq 80000000:\\
\;\;\;\;{x}^{-0.5} + \frac{-1}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x \cdot x}}{{x}^{-0.5} + \frac{1}{t_0}}\\
\end{array}
\end{array}
if x < 8e7Initial program 99.4%
add-log-exp6.4%
*-un-lft-identity6.4%
log-prod6.4%
metadata-eval6.4%
add-log-exp99.4%
pow1/299.4%
pow-flip99.6%
metadata-eval99.6%
Applied egg-rr99.6%
+-lft-identity99.6%
Simplified99.6%
if 8e7 < x Initial program 36.8%
sub-neg36.8%
flip-+36.8%
frac-times18.6%
metadata-eval18.6%
add-sqr-sqrt14.8%
distribute-neg-frac14.8%
metadata-eval14.8%
+-commutative14.8%
distribute-neg-frac14.8%
metadata-eval14.8%
+-commutative14.8%
pow1/214.8%
pow-flip14.8%
metadata-eval14.8%
Applied egg-rr14.8%
associate-*r/18.3%
associate-*l/18.3%
metadata-eval18.3%
sub-neg18.3%
distribute-neg-frac18.3%
metadata-eval18.3%
Simplified18.3%
Taylor expanded in x around inf 79.5%
unpow279.5%
Simplified79.5%
Final simplification89.5%
(FPCore (x) :precision binary64 (/ (/ 1.0 (* x (+ x 1.0))) (+ (pow x -0.5) (/ 1.0 (sqrt (+ x 1.0))))))
double code(double x) {
return (1.0 / (x * (x + 1.0))) / (pow(x, -0.5) + (1.0 / sqrt((x + 1.0))));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 / (x * (x + 1.0d0))) / ((x ** (-0.5d0)) + (1.0d0 / sqrt((x + 1.0d0))))
end function
public static double code(double x) {
return (1.0 / (x * (x + 1.0))) / (Math.pow(x, -0.5) + (1.0 / Math.sqrt((x + 1.0))));
}
def code(x): return (1.0 / (x * (x + 1.0))) / (math.pow(x, -0.5) + (1.0 / math.sqrt((x + 1.0))))
function code(x) return Float64(Float64(1.0 / Float64(x * Float64(x + 1.0))) / Float64((x ^ -0.5) + Float64(1.0 / sqrt(Float64(x + 1.0))))) end
function tmp = code(x) tmp = (1.0 / (x * (x + 1.0))) / ((x ^ -0.5) + (1.0 / sqrt((x + 1.0)))); end
code[x_] := N[(N[(1.0 / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Power[x, -0.5], $MachinePrecision] + N[(1.0 / N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x \cdot \left(x + 1\right)}}{{x}^{-0.5} + \frac{1}{\sqrt{x + 1}}}
\end{array}
Initial program 67.9%
sub-neg67.9%
flip-+67.8%
frac-times58.4%
metadata-eval58.4%
add-sqr-sqrt56.6%
distribute-neg-frac56.6%
metadata-eval56.6%
+-commutative56.6%
distribute-neg-frac56.6%
metadata-eval56.6%
+-commutative56.6%
pow1/256.6%
pow-flip56.5%
metadata-eval56.5%
Applied egg-rr56.5%
associate-*r/58.3%
associate-*l/58.3%
metadata-eval58.3%
sub-neg58.3%
distribute-neg-frac58.3%
metadata-eval58.3%
Simplified58.3%
clear-num61.0%
frac-sub68.4%
*-un-lft-identity68.4%
pow168.4%
inv-pow68.4%
pow-div68.1%
metadata-eval68.1%
pow268.1%
add-sqr-sqrt68.8%
+-commutative68.8%
pow168.8%
inv-pow68.8%
pow-div68.8%
metadata-eval68.8%
pow268.8%
add-sqr-sqrt68.8%
+-commutative68.8%
Applied egg-rr68.8%
Taylor expanded in x around 0 89.5%
Final simplification89.5%
(FPCore (x)
:precision binary64
(if (<= x 1.0)
(+ (+ (pow x -0.5) (* x 0.5)) -1.0)
(if (<= x 5.8e+102)
(* 0.5 (sqrt (/ 1.0 (pow x 3.0))))
(/ (/ (+ 1.0 (* x 0.0)) x) (sqrt x)))))
double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = (pow(x, -0.5) + (x * 0.5)) + -1.0;
} else if (x <= 5.8e+102) {
tmp = 0.5 * sqrt((1.0 / pow(x, 3.0)));
} else {
tmp = ((1.0 + (x * 0.0)) / 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)) + (x * 0.5d0)) + (-1.0d0)
else if (x <= 5.8d+102) then
tmp = 0.5d0 * sqrt((1.0d0 / (x ** 3.0d0)))
else
tmp = ((1.0d0 + (x * 0.0d0)) / 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) + (x * 0.5)) + -1.0;
} else if (x <= 5.8e+102) {
tmp = 0.5 * Math.sqrt((1.0 / Math.pow(x, 3.0)));
} else {
tmp = ((1.0 + (x * 0.0)) / x) / Math.sqrt(x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.0: tmp = (math.pow(x, -0.5) + (x * 0.5)) + -1.0 elif x <= 5.8e+102: tmp = 0.5 * math.sqrt((1.0 / math.pow(x, 3.0))) else: tmp = ((1.0 + (x * 0.0)) / x) / math.sqrt(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); elseif (x <= 5.8e+102) tmp = Float64(0.5 * sqrt(Float64(1.0 / (x ^ 3.0)))); else tmp = Float64(Float64(Float64(1.0 + Float64(x * 0.0)) / x) / sqrt(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; elseif (x <= 5.8e+102) tmp = 0.5 * sqrt((1.0 / (x ^ 3.0))); else tmp = ((1.0 + (x * 0.0)) / x) / sqrt(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], If[LessEqual[x, 5.8e+102], N[(0.5 * N[Sqrt[N[(1.0 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + N[(x * 0.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / N[Sqrt[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{elif}\;x \leq 5.8 \cdot 10^{+102}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + x \cdot 0}{x}}{\sqrt{x}}\\
\end{array}
\end{array}
if x < 1Initial program 99.7%
*-un-lft-identity99.7%
clear-num99.7%
associate-/r/99.7%
prod-diff99.7%
*-un-lft-identity99.7%
fma-neg99.7%
*-un-lft-identity99.7%
inv-pow99.7%
sqrt-pow2100.0%
metadata-eval100.0%
pow1/2100.0%
pow-flip100.0%
+-commutative100.0%
metadata-eval100.0%
Applied egg-rr100.0%
fma-udef100.0%
distribute-lft1-in100.0%
metadata-eval100.0%
mul0-lft100.0%
+-rgt-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 99.3%
if 1 < x < 5.8000000000000005e102Initial program 13.2%
*-un-lft-identity13.2%
clear-num13.2%
associate-/r/13.2%
prod-diff13.2%
*-un-lft-identity13.2%
fma-neg13.2%
*-un-lft-identity13.2%
inv-pow13.2%
sqrt-pow213.1%
metadata-eval13.1%
pow1/213.1%
pow-flip13.1%
+-commutative13.1%
metadata-eval13.1%
Applied egg-rr13.1%
fma-udef13.1%
distribute-lft1-in13.1%
metadata-eval13.1%
mul0-lft13.1%
+-rgt-identity13.1%
Simplified13.1%
Taylor expanded in x around inf 93.3%
if 5.8000000000000005e102 < x Initial program 48.7%
add-exp-log4.4%
inv-pow4.4%
pow1/24.4%
pow-pow4.4%
log-pow4.4%
metadata-eval4.4%
+-commutative4.4%
log1p-udef4.4%
Applied egg-rr4.4%
exp-prod5.4%
Simplified5.4%
expm1-log1p-u5.4%
expm1-udef4.5%
add-exp-log4.5%
log-pow4.5%
log1p-udef4.5%
add-log-exp4.5%
pow-to-exp4.5%
+-commutative4.5%
Applied egg-rr4.5%
expm1-def35.3%
expm1-log1p35.3%
Simplified35.3%
flip--35.3%
frac-times16.4%
metadata-eval16.4%
add-sqr-sqrt22.2%
pow-prod-up48.7%
metadata-eval48.7%
inv-pow48.7%
pow1/248.7%
pow-flip48.7%
metadata-eval48.7%
un-div-inv48.7%
frac-sub48.7%
*-un-lft-identity48.7%
Applied egg-rr48.7%
associate-/r*48.7%
associate-/r/48.7%
*-commutative48.7%
associate-*r/48.7%
*-rgt-identity48.7%
associate-/r*48.7%
*-rgt-identity48.7%
associate-/l*48.7%
/-rgt-identity48.7%
*-commutative48.7%
fma-udef48.7%
distribute-lft1-in48.7%
*-commutative48.7%
*-commutative48.7%
associate-*r*48.7%
associate-/l/48.7%
Simplified99.6%
Taylor expanded in x around inf 54.9%
Final simplification82.4%
(FPCore (x)
:precision binary64
(if (<= x 135000000.0)
(- (pow x -0.5) (pow (+ x 1.0) -0.5))
(if (<= x 5.8e+102)
(* 0.5 (sqrt (/ 1.0 (pow x 3.0))))
(/ (/ (+ 1.0 (* x 0.0)) x) (sqrt x)))))
double code(double x) {
double tmp;
if (x <= 135000000.0) {
tmp = pow(x, -0.5) - pow((x + 1.0), -0.5);
} else if (x <= 5.8e+102) {
tmp = 0.5 * sqrt((1.0 / pow(x, 3.0)));
} else {
tmp = ((1.0 + (x * 0.0)) / x) / sqrt(x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 135000000.0d0) then
tmp = (x ** (-0.5d0)) - ((x + 1.0d0) ** (-0.5d0))
else if (x <= 5.8d+102) then
tmp = 0.5d0 * sqrt((1.0d0 / (x ** 3.0d0)))
else
tmp = ((1.0d0 + (x * 0.0d0)) / x) / sqrt(x)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 135000000.0) {
tmp = Math.pow(x, -0.5) - Math.pow((x + 1.0), -0.5);
} else if (x <= 5.8e+102) {
tmp = 0.5 * Math.sqrt((1.0 / Math.pow(x, 3.0)));
} else {
tmp = ((1.0 + (x * 0.0)) / x) / Math.sqrt(x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 135000000.0: tmp = math.pow(x, -0.5) - math.pow((x + 1.0), -0.5) elif x <= 5.8e+102: tmp = 0.5 * math.sqrt((1.0 / math.pow(x, 3.0))) else: tmp = ((1.0 + (x * 0.0)) / x) / math.sqrt(x) return tmp
function code(x) tmp = 0.0 if (x <= 135000000.0) tmp = Float64((x ^ -0.5) - (Float64(x + 1.0) ^ -0.5)); elseif (x <= 5.8e+102) tmp = Float64(0.5 * sqrt(Float64(1.0 / (x ^ 3.0)))); else tmp = Float64(Float64(Float64(1.0 + Float64(x * 0.0)) / x) / sqrt(x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 135000000.0) tmp = (x ^ -0.5) - ((x + 1.0) ^ -0.5); elseif (x <= 5.8e+102) tmp = 0.5 * sqrt((1.0 / (x ^ 3.0))); else tmp = ((1.0 + (x * 0.0)) / x) / sqrt(x); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 135000000.0], N[(N[Power[x, -0.5], $MachinePrecision] - N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.8e+102], N[(0.5 * N[Sqrt[N[(1.0 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + N[(x * 0.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 135000000:\\
\;\;\;\;{x}^{-0.5} - {\left(x + 1\right)}^{-0.5}\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{+102}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + x \cdot 0}{x}}{\sqrt{x}}\\
\end{array}
\end{array}
if x < 1.35e8Initial program 99.4%
*-un-lft-identity99.4%
clear-num99.4%
associate-/r/99.4%
prod-diff99.4%
*-un-lft-identity99.4%
fma-neg99.4%
*-un-lft-identity99.4%
inv-pow99.4%
sqrt-pow299.6%
metadata-eval99.6%
pow1/299.6%
pow-flip99.6%
+-commutative99.6%
metadata-eval99.6%
Applied egg-rr99.6%
fma-udef99.6%
distribute-lft1-in99.6%
metadata-eval99.6%
mul0-lft99.6%
+-rgt-identity99.6%
Simplified99.6%
if 1.35e8 < x < 5.8000000000000005e102Initial program 7.2%
*-un-lft-identity7.2%
clear-num7.2%
associate-/r/7.2%
prod-diff7.2%
*-un-lft-identity7.2%
fma-neg7.2%
*-un-lft-identity7.2%
inv-pow7.2%
sqrt-pow27.3%
metadata-eval7.3%
pow1/27.3%
pow-flip7.3%
+-commutative7.3%
metadata-eval7.3%
Applied egg-rr7.3%
fma-udef7.3%
distribute-lft1-in7.3%
metadata-eval7.3%
mul0-lft7.3%
+-rgt-identity7.3%
Simplified7.3%
Taylor expanded in x around inf 98.1%
if 5.8000000000000005e102 < x Initial program 48.7%
add-exp-log4.4%
inv-pow4.4%
pow1/24.4%
pow-pow4.4%
log-pow4.4%
metadata-eval4.4%
+-commutative4.4%
log1p-udef4.4%
Applied egg-rr4.4%
exp-prod5.4%
Simplified5.4%
expm1-log1p-u5.4%
expm1-udef4.5%
add-exp-log4.5%
log-pow4.5%
log1p-udef4.5%
add-log-exp4.5%
pow-to-exp4.5%
+-commutative4.5%
Applied egg-rr4.5%
expm1-def35.3%
expm1-log1p35.3%
Simplified35.3%
flip--35.3%
frac-times16.4%
metadata-eval16.4%
add-sqr-sqrt22.2%
pow-prod-up48.7%
metadata-eval48.7%
inv-pow48.7%
pow1/248.7%
pow-flip48.7%
metadata-eval48.7%
un-div-inv48.7%
frac-sub48.7%
*-un-lft-identity48.7%
Applied egg-rr48.7%
associate-/r*48.7%
associate-/r/48.7%
*-commutative48.7%
associate-*r/48.7%
*-rgt-identity48.7%
associate-/r*48.7%
*-rgt-identity48.7%
associate-/l*48.7%
/-rgt-identity48.7%
*-commutative48.7%
fma-udef48.7%
distribute-lft1-in48.7%
*-commutative48.7%
*-commutative48.7%
associate-*r*48.7%
associate-/l/48.7%
Simplified99.6%
Taylor expanded in x around inf 54.9%
Final simplification83.3%
(FPCore (x)
:precision binary64
(if (<= x 48000000.0)
(+ (pow x -0.5) (/ -1.0 (sqrt (+ x 1.0))))
(if (<= x 5.8e+102)
(* 0.5 (sqrt (/ 1.0 (pow x 3.0))))
(/ (/ (+ 1.0 (* x 0.0)) x) (sqrt x)))))
double code(double x) {
double tmp;
if (x <= 48000000.0) {
tmp = pow(x, -0.5) + (-1.0 / sqrt((x + 1.0)));
} else if (x <= 5.8e+102) {
tmp = 0.5 * sqrt((1.0 / pow(x, 3.0)));
} else {
tmp = ((1.0 + (x * 0.0)) / x) / sqrt(x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 48000000.0d0) then
tmp = (x ** (-0.5d0)) + ((-1.0d0) / sqrt((x + 1.0d0)))
else if (x <= 5.8d+102) then
tmp = 0.5d0 * sqrt((1.0d0 / (x ** 3.0d0)))
else
tmp = ((1.0d0 + (x * 0.0d0)) / x) / sqrt(x)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 48000000.0) {
tmp = Math.pow(x, -0.5) + (-1.0 / Math.sqrt((x + 1.0)));
} else if (x <= 5.8e+102) {
tmp = 0.5 * Math.sqrt((1.0 / Math.pow(x, 3.0)));
} else {
tmp = ((1.0 + (x * 0.0)) / x) / Math.sqrt(x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 48000000.0: tmp = math.pow(x, -0.5) + (-1.0 / math.sqrt((x + 1.0))) elif x <= 5.8e+102: tmp = 0.5 * math.sqrt((1.0 / math.pow(x, 3.0))) else: tmp = ((1.0 + (x * 0.0)) / x) / math.sqrt(x) return tmp
function code(x) tmp = 0.0 if (x <= 48000000.0) tmp = Float64((x ^ -0.5) + Float64(-1.0 / sqrt(Float64(x + 1.0)))); elseif (x <= 5.8e+102) tmp = Float64(0.5 * sqrt(Float64(1.0 / (x ^ 3.0)))); else tmp = Float64(Float64(Float64(1.0 + Float64(x * 0.0)) / x) / sqrt(x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 48000000.0) tmp = (x ^ -0.5) + (-1.0 / sqrt((x + 1.0))); elseif (x <= 5.8e+102) tmp = 0.5 * sqrt((1.0 / (x ^ 3.0))); else tmp = ((1.0 + (x * 0.0)) / x) / sqrt(x); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 48000000.0], N[(N[Power[x, -0.5], $MachinePrecision] + N[(-1.0 / N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.8e+102], N[(0.5 * N[Sqrt[N[(1.0 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + N[(x * 0.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 48000000:\\
\;\;\;\;{x}^{-0.5} + \frac{-1}{\sqrt{x + 1}}\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{+102}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + x \cdot 0}{x}}{\sqrt{x}}\\
\end{array}
\end{array}
if x < 4.8e7Initial program 99.4%
add-log-exp6.4%
*-un-lft-identity6.4%
log-prod6.4%
metadata-eval6.4%
add-log-exp99.4%
pow1/299.4%
pow-flip99.6%
metadata-eval99.6%
Applied egg-rr99.6%
+-lft-identity99.6%
Simplified99.6%
if 4.8e7 < x < 5.8000000000000005e102Initial program 7.2%
*-un-lft-identity7.2%
clear-num7.2%
associate-/r/7.2%
prod-diff7.2%
*-un-lft-identity7.2%
fma-neg7.2%
*-un-lft-identity7.2%
inv-pow7.2%
sqrt-pow27.3%
metadata-eval7.3%
pow1/27.3%
pow-flip7.3%
+-commutative7.3%
metadata-eval7.3%
Applied egg-rr7.3%
fma-udef7.3%
distribute-lft1-in7.3%
metadata-eval7.3%
mul0-lft7.3%
+-rgt-identity7.3%
Simplified7.3%
Taylor expanded in x around inf 98.1%
if 5.8000000000000005e102 < x Initial program 48.7%
add-exp-log4.4%
inv-pow4.4%
pow1/24.4%
pow-pow4.4%
log-pow4.4%
metadata-eval4.4%
+-commutative4.4%
log1p-udef4.4%
Applied egg-rr4.4%
exp-prod5.4%
Simplified5.4%
expm1-log1p-u5.4%
expm1-udef4.5%
add-exp-log4.5%
log-pow4.5%
log1p-udef4.5%
add-log-exp4.5%
pow-to-exp4.5%
+-commutative4.5%
Applied egg-rr4.5%
expm1-def35.3%
expm1-log1p35.3%
Simplified35.3%
flip--35.3%
frac-times16.4%
metadata-eval16.4%
add-sqr-sqrt22.2%
pow-prod-up48.7%
metadata-eval48.7%
inv-pow48.7%
pow1/248.7%
pow-flip48.7%
metadata-eval48.7%
un-div-inv48.7%
frac-sub48.7%
*-un-lft-identity48.7%
Applied egg-rr48.7%
associate-/r*48.7%
associate-/r/48.7%
*-commutative48.7%
associate-*r/48.7%
*-rgt-identity48.7%
associate-/r*48.7%
*-rgt-identity48.7%
associate-/l*48.7%
/-rgt-identity48.7%
*-commutative48.7%
fma-udef48.7%
distribute-lft1-in48.7%
*-commutative48.7%
*-commutative48.7%
associate-*r*48.7%
associate-/l/48.7%
Simplified99.6%
Taylor expanded in x around inf 54.9%
Final simplification83.3%
(FPCore (x) :precision binary64 (if (<= x 1.5) (+ (+ (pow x -0.5) (* x 0.5)) -1.0) (/ (/ (+ 1.0 (* x 0.0)) x) (sqrt x))))
double code(double x) {
double tmp;
if (x <= 1.5) {
tmp = (pow(x, -0.5) + (x * 0.5)) + -1.0;
} else {
tmp = ((1.0 + (x * 0.0)) / x) / sqrt(x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 1.5d0) then
tmp = ((x ** (-0.5d0)) + (x * 0.5d0)) + (-1.0d0)
else
tmp = ((1.0d0 + (x * 0.0d0)) / x) / sqrt(x)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 1.5) {
tmp = (Math.pow(x, -0.5) + (x * 0.5)) + -1.0;
} else {
tmp = ((1.0 + (x * 0.0)) / x) / Math.sqrt(x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.5: tmp = (math.pow(x, -0.5) + (x * 0.5)) + -1.0 else: tmp = ((1.0 + (x * 0.0)) / x) / math.sqrt(x) return tmp
function code(x) tmp = 0.0 if (x <= 1.5) tmp = Float64(Float64((x ^ -0.5) + Float64(x * 0.5)) + -1.0); else tmp = Float64(Float64(Float64(1.0 + Float64(x * 0.0)) / x) / sqrt(x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.5) tmp = ((x ^ -0.5) + (x * 0.5)) + -1.0; else tmp = ((1.0 + (x * 0.0)) / x) / sqrt(x); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.5], N[(N[(N[Power[x, -0.5], $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(N[(1.0 + N[(x * 0.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.5:\\
\;\;\;\;\left({x}^{-0.5} + x \cdot 0.5\right) + -1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + x \cdot 0}{x}}{\sqrt{x}}\\
\end{array}
\end{array}
if x < 1.5Initial program 99.7%
*-un-lft-identity99.7%
clear-num99.7%
associate-/r/99.7%
prod-diff99.7%
*-un-lft-identity99.7%
fma-neg99.7%
*-un-lft-identity99.7%
inv-pow99.7%
sqrt-pow2100.0%
metadata-eval100.0%
pow1/2100.0%
pow-flip100.0%
+-commutative100.0%
metadata-eval100.0%
Applied egg-rr100.0%
fma-udef100.0%
distribute-lft1-in100.0%
metadata-eval100.0%
mul0-lft100.0%
+-rgt-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 99.3%
if 1.5 < x Initial program 37.9%
add-exp-log7.1%
inv-pow7.1%
pow1/27.1%
pow-pow7.1%
log-pow7.1%
metadata-eval7.1%
+-commutative7.1%
log1p-udef7.1%
Applied egg-rr7.1%
exp-prod7.9%
Simplified7.9%
expm1-log1p-u7.9%
expm1-udef7.0%
add-exp-log7.0%
log-pow7.0%
log1p-udef7.0%
add-log-exp7.0%
pow-to-exp7.0%
+-commutative7.0%
Applied egg-rr7.0%
expm1-def28.7%
expm1-log1p28.7%
Simplified28.7%
flip--28.7%
frac-times15.6%
metadata-eval15.6%
add-sqr-sqrt19.6%
pow-prod-up38.1%
metadata-eval38.1%
inv-pow38.1%
pow1/238.1%
pow-flip38.1%
metadata-eval38.1%
un-div-inv38.1%
frac-sub40.2%
*-un-lft-identity40.2%
Applied egg-rr40.2%
associate-/r*40.2%
associate-/r/40.2%
*-commutative40.2%
associate-*r/40.2%
*-rgt-identity40.2%
associate-/r*40.2%
*-rgt-identity40.2%
associate-/l*40.2%
/-rgt-identity40.2%
*-commutative40.2%
fma-udef40.2%
distribute-lft1-in40.2%
*-commutative40.2%
*-commutative40.2%
associate-*r*40.2%
associate-/l/40.2%
Simplified99.5%
Taylor expanded in x around inf 43.9%
Final simplification70.8%
(FPCore (x) :precision binary64 (/ (/ 1.0 (+ x (sqrt x))) (+ x 1.0)))
double code(double x) {
return (1.0 / (x + sqrt(x))) / (x + 1.0);
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 / (x + sqrt(x))) / (x + 1.0d0)
end function
public static double code(double x) {
return (1.0 / (x + Math.sqrt(x))) / (x + 1.0);
}
def code(x): return (1.0 / (x + math.sqrt(x))) / (x + 1.0)
function code(x) return Float64(Float64(1.0 / Float64(x + sqrt(x))) / Float64(x + 1.0)) end
function tmp = code(x) tmp = (1.0 / (x + sqrt(x))) / (x + 1.0); end
code[x_] := N[(N[(1.0 / N[(x + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x + \sqrt{x}}}{x + 1}
\end{array}
Initial program 67.9%
*-un-lft-identity67.9%
clear-num67.9%
associate-/r/67.9%
prod-diff67.9%
*-un-lft-identity67.9%
fma-neg67.9%
*-un-lft-identity67.9%
inv-pow67.9%
sqrt-pow263.2%
metadata-eval63.2%
pow1/263.2%
pow-flip68.0%
+-commutative68.0%
metadata-eval68.0%
Applied egg-rr68.0%
fma-udef68.0%
distribute-lft1-in68.0%
metadata-eval68.0%
mul0-lft68.0%
+-rgt-identity68.0%
Simplified68.0%
Applied egg-rr67.6%
Taylor expanded in x around 0 66.0%
*-commutative66.0%
frac-sub66.0%
frac-times66.0%
*-un-lft-identity66.0%
*-un-lft-identity66.0%
*-rgt-identity66.0%
+-commutative66.0%
+-commutative66.0%
+-commutative66.0%
Applied egg-rr66.0%
associate--l+66.7%
+-inverses66.7%
metadata-eval66.7%
associate-*r*66.7%
associate-/r*66.7%
*-commutative66.7%
distribute-rgt-in66.7%
*-lft-identity66.7%
pow-plus66.9%
metadata-eval66.9%
unpow1/266.9%
Simplified66.9%
Final simplification66.9%
(FPCore (x) :precision binary64 (if (<= x 1.35e+154) (sqrt (/ 1.0 x)) (- (pow (* x x) -0.25))))
double code(double x) {
double tmp;
if (x <= 1.35e+154) {
tmp = sqrt((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 <= 1.35d+154) then
tmp = sqrt((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 <= 1.35e+154) {
tmp = Math.sqrt((1.0 / x));
} else {
tmp = -Math.pow((x * x), -0.25);
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.35e+154: tmp = math.sqrt((1.0 / x)) else: tmp = -math.pow((x * x), -0.25) return tmp
function code(x) tmp = 0.0 if (x <= 1.35e+154) tmp = sqrt(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 <= 1.35e+154) tmp = sqrt((1.0 / x)); else tmp = -((x * x) ^ -0.25); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.35e+154], N[Sqrt[N[(1.0 / x), $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}:\\
\;\;\;\;\sqrt{\frac{1}{x}}\\
\mathbf{else}:\\
\;\;\;\;-{\left(x \cdot x\right)}^{-0.25}\\
\end{array}
\end{array}
if x < 1.35000000000000003e154Initial program 69.6%
add-log-exp5.4%
*-un-lft-identity5.4%
log-prod5.4%
metadata-eval5.4%
add-log-exp69.6%
pow1/269.6%
pow-flip69.8%
metadata-eval69.8%
Applied egg-rr69.8%
+-lft-identity69.8%
Simplified69.8%
Taylor expanded in x around inf 66.9%
if 1.35000000000000003e154 < x Initial program 63.1%
add-exp-log4.4%
inv-pow4.4%
pow1/24.4%
pow-pow4.4%
log-pow4.4%
metadata-eval4.4%
+-commutative4.4%
log1p-udef4.4%
Applied egg-rr4.4%
exp-prod5.8%
Simplified5.8%
Taylor expanded in x around inf 4.0%
mul-1-neg4.0%
Simplified4.0%
inv-pow4.0%
sqrt-pow14.0%
metadata-eval4.0%
sqr-pow4.0%
pow-prod-down63.1%
metadata-eval63.1%
Applied egg-rr63.1%
Final simplification65.9%
(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 69.6%
*-un-lft-identity69.6%
clear-num69.6%
associate-/r/69.6%
prod-diff69.6%
*-un-lft-identity69.6%
fma-neg69.6%
*-un-lft-identity69.6%
inv-pow69.6%
sqrt-pow269.8%
metadata-eval69.8%
pow1/269.8%
pow-flip69.8%
+-commutative69.8%
metadata-eval69.8%
Applied egg-rr69.8%
fma-udef69.8%
distribute-lft1-in69.8%
metadata-eval69.8%
mul0-lft69.8%
+-rgt-identity69.8%
Simplified69.8%
Applied egg-rr69.3%
Taylor expanded in x around 0 67.0%
Taylor expanded in x around 0 67.9%
+-commutative67.9%
*-commutative67.9%
distribute-rgt-in67.9%
*-lft-identity67.9%
pow-plus68.2%
metadata-eval68.2%
unpow1/268.2%
Simplified68.2%
if 1.35000000000000003e154 < x Initial program 63.1%
add-exp-log4.4%
inv-pow4.4%
pow1/24.4%
pow-pow4.4%
log-pow4.4%
metadata-eval4.4%
+-commutative4.4%
log1p-udef4.4%
Applied egg-rr4.4%
exp-prod5.8%
Simplified5.8%
Taylor expanded in x around inf 4.0%
mul-1-neg4.0%
Simplified4.0%
inv-pow4.0%
sqrt-pow14.0%
metadata-eval4.0%
sqr-pow4.0%
pow-prod-down63.1%
metadata-eval63.1%
Applied egg-rr63.1%
Final simplification66.8%
(FPCore (x) :precision binary64 (sqrt (/ 1.0 x)))
double code(double x) {
return sqrt((1.0 / x));
}
real(8) function code(x)
real(8), intent (in) :: x
code = sqrt((1.0d0 / x))
end function
public static double code(double x) {
return Math.sqrt((1.0 / x));
}
def code(x): return math.sqrt((1.0 / x))
function code(x) return sqrt(Float64(1.0 / x)) end
function tmp = code(x) tmp = sqrt((1.0 / x)); end
code[x_] := N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{1}{x}}
\end{array}
Initial program 67.9%
add-log-exp5.0%
*-un-lft-identity5.0%
log-prod5.0%
metadata-eval5.0%
add-log-exp67.9%
pow1/267.9%
pow-flip63.2%
metadata-eval63.2%
Applied egg-rr63.2%
+-lft-identity63.2%
Simplified63.2%
Taylor expanded in x around inf 50.0%
Final simplification50.0%
(FPCore (x) :precision binary64 (* x 0.5))
double code(double x) {
return x * 0.5;
}
real(8) function code(x)
real(8), intent (in) :: x
code = x * 0.5d0
end function
public static double code(double x) {
return x * 0.5;
}
def code(x): return x * 0.5
function code(x) return Float64(x * 0.5) end
function tmp = code(x) tmp = x * 0.5; end
code[x_] := N[(x * 0.5), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5
\end{array}
Initial program 67.9%
*-un-lft-identity67.9%
clear-num67.9%
associate-/r/67.9%
prod-diff67.9%
*-un-lft-identity67.9%
fma-neg67.9%
*-un-lft-identity67.9%
inv-pow67.9%
sqrt-pow263.2%
metadata-eval63.2%
pow1/263.2%
pow-flip68.0%
+-commutative68.0%
metadata-eval68.0%
Applied egg-rr68.0%
fma-udef68.0%
distribute-lft1-in68.0%
metadata-eval68.0%
mul0-lft68.0%
+-rgt-identity68.0%
Simplified68.0%
Taylor expanded in x around 0 49.8%
Taylor expanded in x around inf 3.8%
*-commutative3.8%
Simplified3.8%
Final simplification3.8%
(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.9%
Taylor expanded in x around 0 49.2%
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 2023268
(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)))))