
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (/ t_0 n) x)))
(if (<= (/ 1.0 n) -5e-80)
t_1
(if (<= (/ 1.0 n) 2e-100)
(/ (log (exp (- (log1p x) (log x)))) n)
(if (<= (/ 1.0 n) 20000000.0) t_1 (- (exp (/ (log1p x) n)) t_0))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = (t_0 / n) / x;
double tmp;
if ((1.0 / n) <= -5e-80) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-100) {
tmp = log(exp((log1p(x) - log(x)))) / n;
} else if ((1.0 / n) <= 20000000.0) {
tmp = t_1;
} else {
tmp = exp((log1p(x) / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = (t_0 / n) / x;
double tmp;
if ((1.0 / n) <= -5e-80) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-100) {
tmp = Math.log(Math.exp((Math.log1p(x) - Math.log(x)))) / n;
} else if ((1.0 / n) <= 20000000.0) {
tmp = t_1;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = (t_0 / n) / x tmp = 0 if (1.0 / n) <= -5e-80: tmp = t_1 elif (1.0 / n) <= 2e-100: tmp = math.log(math.exp((math.log1p(x) - math.log(x)))) / n elif (1.0 / n) <= 20000000.0: tmp = t_1 else: tmp = math.exp((math.log1p(x) / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(Float64(t_0 / n) / x) tmp = 0.0 if (Float64(1.0 / n) <= -5e-80) tmp = t_1; elseif (Float64(1.0 / n) <= 2e-100) tmp = Float64(log(exp(Float64(log1p(x) - log(x)))) / n); elseif (Float64(1.0 / n) <= 20000000.0) tmp = t_1; else tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-80], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-100], N[(N[Log[N[Exp[N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 20000000.0], t$95$1, N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\frac{t_0}{n}}{x}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-80}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-100}:\\
\;\;\;\;\frac{\log \left(e^{\mathsf{log1p}\left(x\right) - \log x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 20000000:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -5e-80 or 2e-100 < (/.f64 1 n) < 2e7Initial program 68.6%
Taylor expanded in x around inf 87.2%
log-rec87.2%
mul-1-neg87.2%
mul-1-neg87.2%
distribute-frac-neg87.2%
neg-mul-187.2%
remove-double-neg87.2%
*-rgt-identity87.2%
associate-*r/87.2%
unpow-187.2%
exp-to-pow87.2%
unpow-187.2%
*-commutative87.2%
Simplified87.2%
add-cube-cbrt87.2%
pow387.2%
pow-to-exp87.2%
pow1/387.2%
log-pow87.2%
pow-to-exp87.2%
add-log-exp87.2%
un-div-inv87.2%
Applied egg-rr87.2%
add-sqr-sqrt87.2%
times-frac87.7%
Applied egg-rr87.7%
associate-*l/87.7%
associate-*r/87.7%
add-sqr-sqrt87.7%
Applied egg-rr87.7%
if -5e-80 < (/.f64 1 n) < 2e-100Initial program 37.3%
Taylor expanded in n around inf 84.3%
log1p-def84.3%
Simplified84.3%
add-log-exp84.4%
Applied egg-rr84.4%
if 2e7 < (/.f64 1 n) Initial program 59.2%
Taylor expanded in n around 0 59.2%
log1p-def100.0%
*-rgt-identity100.0%
associate-*r/100.0%
unpow-1100.0%
exp-to-pow100.0%
/-rgt-identity100.0%
metadata-eval100.0%
associate-/l*100.0%
*-commutative100.0%
*-commutative100.0%
associate-/l*100.0%
metadata-eval100.0%
/-rgt-identity100.0%
unpow-1100.0%
Simplified100.0%
Final simplification88.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (/ t_0 n) x)))
(if (<= (/ 1.0 n) -5e-80)
t_1
(if (<= (/ 1.0 n) 2e-100)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 20000000.0) t_1 (- (exp (/ (log1p x) n)) t_0))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = (t_0 / n) / x;
double tmp;
if ((1.0 / n) <= -5e-80) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-100) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 20000000.0) {
tmp = t_1;
} else {
tmp = exp((log1p(x) / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = (t_0 / n) / x;
double tmp;
if ((1.0 / n) <= -5e-80) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-100) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else if ((1.0 / n) <= 20000000.0) {
tmp = t_1;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = (t_0 / n) / x tmp = 0 if (1.0 / n) <= -5e-80: tmp = t_1 elif (1.0 / n) <= 2e-100: tmp = (math.log1p(x) - math.log(x)) / n elif (1.0 / n) <= 20000000.0: tmp = t_1 else: tmp = math.exp((math.log1p(x) / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(Float64(t_0 / n) / x) tmp = 0.0 if (Float64(1.0 / n) <= -5e-80) tmp = t_1; elseif (Float64(1.0 / n) <= 2e-100) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 20000000.0) tmp = t_1; else tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-80], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-100], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 20000000.0], t$95$1, N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\frac{t_0}{n}}{x}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-80}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-100}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 20000000:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -5e-80 or 2e-100 < (/.f64 1 n) < 2e7Initial program 68.6%
Taylor expanded in x around inf 87.2%
log-rec87.2%
mul-1-neg87.2%
mul-1-neg87.2%
distribute-frac-neg87.2%
neg-mul-187.2%
remove-double-neg87.2%
*-rgt-identity87.2%
associate-*r/87.2%
unpow-187.2%
exp-to-pow87.2%
unpow-187.2%
*-commutative87.2%
Simplified87.2%
add-cube-cbrt87.2%
pow387.2%
pow-to-exp87.2%
pow1/387.2%
log-pow87.2%
pow-to-exp87.2%
add-log-exp87.2%
un-div-inv87.2%
Applied egg-rr87.2%
add-sqr-sqrt87.2%
times-frac87.7%
Applied egg-rr87.7%
associate-*l/87.7%
associate-*r/87.7%
add-sqr-sqrt87.7%
Applied egg-rr87.7%
if -5e-80 < (/.f64 1 n) < 2e-100Initial program 37.3%
Taylor expanded in n around inf 84.3%
log1p-def84.3%
Simplified84.3%
if 2e7 < (/.f64 1 n) Initial program 59.2%
Taylor expanded in n around 0 59.2%
log1p-def100.0%
*-rgt-identity100.0%
associate-*r/100.0%
unpow-1100.0%
exp-to-pow100.0%
/-rgt-identity100.0%
metadata-eval100.0%
associate-/l*100.0%
*-commutative100.0%
*-commutative100.0%
associate-/l*100.0%
metadata-eval100.0%
/-rgt-identity100.0%
unpow-1100.0%
Simplified100.0%
Final simplification88.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (/ t_0 n) x)))
(if (<= (/ 1.0 n) -5e-80)
t_1
(if (<= (/ 1.0 n) 2e-100)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 20000000.0)
t_1
(if (<= (/ 1.0 n) 4e+152)
(- (pow (+ 1.0 x) (/ 1.0 n)) t_0)
(/ (/ (/ 1.0 n) x) t_0)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = (t_0 / n) / x;
double tmp;
if ((1.0 / n) <= -5e-80) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-100) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 20000000.0) {
tmp = t_1;
} else if ((1.0 / n) <= 4e+152) {
tmp = pow((1.0 + x), (1.0 / n)) - t_0;
} else {
tmp = ((1.0 / n) / x) / t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = (t_0 / n) / x;
double tmp;
if ((1.0 / n) <= -5e-80) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-100) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else if ((1.0 / n) <= 20000000.0) {
tmp = t_1;
} else if ((1.0 / n) <= 4e+152) {
tmp = Math.pow((1.0 + x), (1.0 / n)) - t_0;
} else {
tmp = ((1.0 / n) / x) / t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = (t_0 / n) / x tmp = 0 if (1.0 / n) <= -5e-80: tmp = t_1 elif (1.0 / n) <= 2e-100: tmp = (math.log1p(x) - math.log(x)) / n elif (1.0 / n) <= 20000000.0: tmp = t_1 elif (1.0 / n) <= 4e+152: tmp = math.pow((1.0 + x), (1.0 / n)) - t_0 else: tmp = ((1.0 / n) / x) / t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(Float64(t_0 / n) / x) tmp = 0.0 if (Float64(1.0 / n) <= -5e-80) tmp = t_1; elseif (Float64(1.0 / n) <= 2e-100) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 20000000.0) tmp = t_1; elseif (Float64(1.0 / n) <= 4e+152) tmp = Float64((Float64(1.0 + x) ^ Float64(1.0 / n)) - t_0); else tmp = Float64(Float64(Float64(1.0 / n) / x) / t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-80], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-100], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 20000000.0], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+152], N[(N[Power[N[(1.0 + x), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision] / t$95$0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\frac{t_0}{n}}{x}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-80}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-100}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 20000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+152}:\\
\;\;\;\;{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{n}}{x}}{t_0}\\
\end{array}
\end{array}
if (/.f64 1 n) < -5e-80 or 2e-100 < (/.f64 1 n) < 2e7Initial program 68.6%
Taylor expanded in x around inf 87.2%
log-rec87.2%
mul-1-neg87.2%
mul-1-neg87.2%
distribute-frac-neg87.2%
neg-mul-187.2%
remove-double-neg87.2%
*-rgt-identity87.2%
associate-*r/87.2%
unpow-187.2%
exp-to-pow87.2%
unpow-187.2%
*-commutative87.2%
Simplified87.2%
add-cube-cbrt87.2%
pow387.2%
pow-to-exp87.2%
pow1/387.2%
log-pow87.2%
pow-to-exp87.2%
add-log-exp87.2%
un-div-inv87.2%
Applied egg-rr87.2%
add-sqr-sqrt87.2%
times-frac87.7%
Applied egg-rr87.7%
associate-*l/87.7%
associate-*r/87.7%
add-sqr-sqrt87.7%
Applied egg-rr87.7%
if -5e-80 < (/.f64 1 n) < 2e-100Initial program 37.3%
Taylor expanded in n around inf 84.3%
log1p-def84.3%
Simplified84.3%
if 2e7 < (/.f64 1 n) < 4.0000000000000002e152Initial program 91.5%
if 4.0000000000000002e152 < (/.f64 1 n) Initial program 22.5%
Taylor expanded in x around inf 0.7%
log-rec0.7%
mul-1-neg0.7%
mul-1-neg0.7%
distribute-frac-neg0.7%
neg-mul-10.7%
remove-double-neg0.7%
*-rgt-identity0.7%
associate-*r/0.7%
unpow-10.7%
exp-to-pow0.7%
unpow-10.7%
*-commutative0.7%
Simplified0.7%
add-cube-cbrt0.7%
pow30.7%
pow-to-exp0.7%
pow1/30.7%
log-pow0.7%
pow-to-exp0.7%
add-log-exp0.7%
un-div-inv0.7%
Applied egg-rr0.7%
clear-num0.7%
inv-pow0.7%
Applied egg-rr87.1%
unpow-187.1%
associate-/r*87.1%
*-commutative87.1%
associate-/r*87.1%
Simplified87.1%
Final simplification86.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (/ t_0 n) x)))
(if (<= (/ 1.0 n) -5e-80)
t_1
(if (<= (/ 1.0 n) 2e-100)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 20000000.0)
t_1
(-
(+ (* (- (/ 0.5 (* n n)) (/ 0.5 n)) (* x x)) (+ 1.0 (/ x n)))
t_0))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = (t_0 / n) / x;
double tmp;
if ((1.0 / n) <= -5e-80) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-100) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 20000000.0) {
tmp = t_1;
} else {
tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + (1.0 + (x / n))) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = (t_0 / n) / x;
double tmp;
if ((1.0 / n) <= -5e-80) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-100) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else if ((1.0 / n) <= 20000000.0) {
tmp = t_1;
} else {
tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + (1.0 + (x / n))) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = (t_0 / n) / x tmp = 0 if (1.0 / n) <= -5e-80: tmp = t_1 elif (1.0 / n) <= 2e-100: tmp = (math.log1p(x) - math.log(x)) / n elif (1.0 / n) <= 20000000.0: tmp = t_1 else: tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + (1.0 + (x / n))) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(Float64(t_0 / n) / x) tmp = 0.0 if (Float64(1.0 / n) <= -5e-80) tmp = t_1; elseif (Float64(1.0 / n) <= 2e-100) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 20000000.0) tmp = t_1; else tmp = Float64(Float64(Float64(Float64(Float64(0.5 / Float64(n * n)) - Float64(0.5 / n)) * Float64(x * x)) + Float64(1.0 + Float64(x / n))) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-80], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-100], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 20000000.0], t$95$1, N[(N[(N[(N[(N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\frac{t_0}{n}}{x}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-80}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-100}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 20000000:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\frac{0.5}{n \cdot n} - \frac{0.5}{n}\right) \cdot \left(x \cdot x\right) + \left(1 + \frac{x}{n}\right)\right) - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -5e-80 or 2e-100 < (/.f64 1 n) < 2e7Initial program 68.6%
Taylor expanded in x around inf 87.2%
log-rec87.2%
mul-1-neg87.2%
mul-1-neg87.2%
distribute-frac-neg87.2%
neg-mul-187.2%
remove-double-neg87.2%
*-rgt-identity87.2%
associate-*r/87.2%
unpow-187.2%
exp-to-pow87.2%
unpow-187.2%
*-commutative87.2%
Simplified87.2%
add-cube-cbrt87.2%
pow387.2%
pow-to-exp87.2%
pow1/387.2%
log-pow87.2%
pow-to-exp87.2%
add-log-exp87.2%
un-div-inv87.2%
Applied egg-rr87.2%
add-sqr-sqrt87.2%
times-frac87.7%
Applied egg-rr87.7%
associate-*l/87.7%
associate-*r/87.7%
add-sqr-sqrt87.7%
Applied egg-rr87.7%
if -5e-80 < (/.f64 1 n) < 2e-100Initial program 37.3%
Taylor expanded in n around inf 84.3%
log1p-def84.3%
Simplified84.3%
if 2e7 < (/.f64 1 n) Initial program 59.2%
Taylor expanded in x around 0 69.4%
associate-+r+69.4%
+-commutative69.4%
associate-*r/69.4%
metadata-eval69.4%
unpow269.4%
associate-*r/69.4%
metadata-eval69.4%
unpow269.4%
Simplified69.4%
Final simplification84.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= x 1.4e-236)
(- 1.0 t_0)
(if (<= x 3.05e-186)
(/ (- (log x)) n)
(if (<= x 2.2e-118)
(- (+ 1.0 (/ x n)) t_0)
(if (<= x 0.00043)
(+ (* -0.5 (/ (* x x) n)) (- (/ x n) (/ (log x) n)))
(/ (/ t_0 n) x)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (x <= 1.4e-236) {
tmp = 1.0 - t_0;
} else if (x <= 3.05e-186) {
tmp = -log(x) / n;
} else if (x <= 2.2e-118) {
tmp = (1.0 + (x / n)) - t_0;
} else if (x <= 0.00043) {
tmp = (-0.5 * ((x * x) / n)) + ((x / n) - (log(x) / n));
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if (x <= 1.4d-236) then
tmp = 1.0d0 - t_0
else if (x <= 3.05d-186) then
tmp = -log(x) / n
else if (x <= 2.2d-118) then
tmp = (1.0d0 + (x / n)) - t_0
else if (x <= 0.00043d0) then
tmp = ((-0.5d0) * ((x * x) / n)) + ((x / n) - (log(x) / n))
else
tmp = (t_0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= 1.4e-236) {
tmp = 1.0 - t_0;
} else if (x <= 3.05e-186) {
tmp = -Math.log(x) / n;
} else if (x <= 2.2e-118) {
tmp = (1.0 + (x / n)) - t_0;
} else if (x <= 0.00043) {
tmp = (-0.5 * ((x * x) / n)) + ((x / n) - (Math.log(x) / n));
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if x <= 1.4e-236: tmp = 1.0 - t_0 elif x <= 3.05e-186: tmp = -math.log(x) / n elif x <= 2.2e-118: tmp = (1.0 + (x / n)) - t_0 elif x <= 0.00043: tmp = (-0.5 * ((x * x) / n)) + ((x / n) - (math.log(x) / n)) else: tmp = (t_0 / n) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= 1.4e-236) tmp = Float64(1.0 - t_0); elseif (x <= 3.05e-186) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 2.2e-118) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); elseif (x <= 0.00043) tmp = Float64(Float64(-0.5 * Float64(Float64(x * x) / n)) + Float64(Float64(x / n) - Float64(log(x) / n))); else tmp = Float64(Float64(t_0 / n) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if (x <= 1.4e-236) tmp = 1.0 - t_0; elseif (x <= 3.05e-186) tmp = -log(x) / n; elseif (x <= 2.2e-118) tmp = (1.0 + (x / n)) - t_0; elseif (x <= 0.00043) tmp = (-0.5 * ((x * x) / n)) + ((x / n) - (log(x) / n)); else tmp = (t_0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 1.4e-236], N[(1.0 - t$95$0), $MachinePrecision], If[LessEqual[x, 3.05e-186], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 2.2e-118], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 0.00043], N[(N[(-0.5 * N[(N[(x * x), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] + N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 1.4 \cdot 10^{-236}:\\
\;\;\;\;1 - t_0\\
\mathbf{elif}\;x \leq 3.05 \cdot 10^{-186}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{-118}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{elif}\;x \leq 0.00043:\\
\;\;\;\;-0.5 \cdot \frac{x \cdot x}{n} + \left(\frac{x}{n} - \frac{\log x}{n}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_0}{n}}{x}\\
\end{array}
\end{array}
if x < 1.39999999999999993e-236Initial program 64.4%
Taylor expanded in x around 0 64.4%
*-rgt-identity64.4%
associate-*r/64.4%
unpow-164.4%
exp-to-pow64.4%
unpow-164.4%
Simplified64.4%
if 1.39999999999999993e-236 < x < 3.04999999999999991e-186Initial program 30.7%
Taylor expanded in n around inf 61.6%
log1p-def61.6%
Simplified61.6%
Taylor expanded in x around 0 61.6%
neg-mul-161.6%
Simplified61.6%
if 3.04999999999999991e-186 < x < 2.19999999999999984e-118Initial program 73.5%
Taylor expanded in x around 0 75.1%
if 2.19999999999999984e-118 < x < 4.29999999999999989e-4Initial program 32.6%
Taylor expanded in n around inf 59.3%
log1p-def59.3%
Simplified59.3%
Taylor expanded in x around 0 59.3%
+-commutative59.3%
neg-mul-159.3%
+-commutative59.3%
associate-+l+59.3%
unpow259.3%
+-commutative59.3%
unsub-neg59.3%
Simplified59.3%
if 4.29999999999999989e-4 < x Initial program 64.3%
Taylor expanded in x around inf 96.7%
log-rec96.7%
mul-1-neg96.7%
mul-1-neg96.7%
distribute-frac-neg96.7%
neg-mul-196.7%
remove-double-neg96.7%
*-rgt-identity96.7%
associate-*r/96.7%
unpow-196.7%
exp-to-pow96.7%
unpow-196.7%
*-commutative96.7%
Simplified96.7%
add-cube-cbrt96.7%
pow396.7%
pow-to-exp96.7%
pow1/396.7%
log-pow96.7%
pow-to-exp96.7%
add-log-exp96.7%
un-div-inv96.7%
Applied egg-rr96.7%
add-sqr-sqrt96.7%
times-frac98.4%
Applied egg-rr98.3%
associate-*l/98.4%
associate-*r/98.4%
add-sqr-sqrt98.4%
Applied egg-rr98.4%
Final simplification80.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= x 3.6e-236)
(- 1.0 t_0)
(if (<= x 6.3e-187)
(/ (- (log x)) n)
(if (<= x 2.5e-118)
(- (+ 1.0 (/ x n)) t_0)
(if (<= x 0.0035)
(- (+ (/ x n) (* -0.5 (/ (* x x) n))) (/ (log x) n))
(/ (/ t_0 n) x)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (x <= 3.6e-236) {
tmp = 1.0 - t_0;
} else if (x <= 6.3e-187) {
tmp = -log(x) / n;
} else if (x <= 2.5e-118) {
tmp = (1.0 + (x / n)) - t_0;
} else if (x <= 0.0035) {
tmp = ((x / n) + (-0.5 * ((x * x) / n))) - (log(x) / n);
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if (x <= 3.6d-236) then
tmp = 1.0d0 - t_0
else if (x <= 6.3d-187) then
tmp = -log(x) / n
else if (x <= 2.5d-118) then
tmp = (1.0d0 + (x / n)) - t_0
else if (x <= 0.0035d0) then
tmp = ((x / n) + ((-0.5d0) * ((x * x) / n))) - (log(x) / n)
else
tmp = (t_0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= 3.6e-236) {
tmp = 1.0 - t_0;
} else if (x <= 6.3e-187) {
tmp = -Math.log(x) / n;
} else if (x <= 2.5e-118) {
tmp = (1.0 + (x / n)) - t_0;
} else if (x <= 0.0035) {
tmp = ((x / n) + (-0.5 * ((x * x) / n))) - (Math.log(x) / n);
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if x <= 3.6e-236: tmp = 1.0 - t_0 elif x <= 6.3e-187: tmp = -math.log(x) / n elif x <= 2.5e-118: tmp = (1.0 + (x / n)) - t_0 elif x <= 0.0035: tmp = ((x / n) + (-0.5 * ((x * x) / n))) - (math.log(x) / n) else: tmp = (t_0 / n) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= 3.6e-236) tmp = Float64(1.0 - t_0); elseif (x <= 6.3e-187) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 2.5e-118) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); elseif (x <= 0.0035) tmp = Float64(Float64(Float64(x / n) + Float64(-0.5 * Float64(Float64(x * x) / n))) - Float64(log(x) / n)); else tmp = Float64(Float64(t_0 / n) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if (x <= 3.6e-236) tmp = 1.0 - t_0; elseif (x <= 6.3e-187) tmp = -log(x) / n; elseif (x <= 2.5e-118) tmp = (1.0 + (x / n)) - t_0; elseif (x <= 0.0035) tmp = ((x / n) + (-0.5 * ((x * x) / n))) - (log(x) / n); else tmp = (t_0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 3.6e-236], N[(1.0 - t$95$0), $MachinePrecision], If[LessEqual[x, 6.3e-187], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 2.5e-118], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 0.0035], N[(N[(N[(x / n), $MachinePrecision] + N[(-0.5 * N[(N[(x * x), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 3.6 \cdot 10^{-236}:\\
\;\;\;\;1 - t_0\\
\mathbf{elif}\;x \leq 6.3 \cdot 10^{-187}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-118}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{elif}\;x \leq 0.0035:\\
\;\;\;\;\left(\frac{x}{n} + -0.5 \cdot \frac{x \cdot x}{n}\right) - \frac{\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_0}{n}}{x}\\
\end{array}
\end{array}
if x < 3.60000000000000008e-236Initial program 64.4%
Taylor expanded in x around 0 64.4%
*-rgt-identity64.4%
associate-*r/64.4%
unpow-164.4%
exp-to-pow64.4%
unpow-164.4%
Simplified64.4%
if 3.60000000000000008e-236 < x < 6.29999999999999952e-187Initial program 30.7%
Taylor expanded in n around inf 61.6%
log1p-def61.6%
Simplified61.6%
Taylor expanded in x around 0 61.6%
neg-mul-161.6%
Simplified61.6%
if 6.29999999999999952e-187 < x < 2.50000000000000007e-118Initial program 73.5%
Taylor expanded in x around 0 75.1%
if 2.50000000000000007e-118 < x < 0.00350000000000000007Initial program 32.6%
Taylor expanded in n around inf 59.3%
log1p-def59.3%
Simplified59.3%
div-sub59.3%
Applied egg-rr59.3%
Taylor expanded in x around 0 59.3%
unpow259.3%
Simplified59.3%
if 0.00350000000000000007 < x Initial program 64.3%
Taylor expanded in x around inf 96.7%
log-rec96.7%
mul-1-neg96.7%
mul-1-neg96.7%
distribute-frac-neg96.7%
neg-mul-196.7%
remove-double-neg96.7%
*-rgt-identity96.7%
associate-*r/96.7%
unpow-196.7%
exp-to-pow96.7%
unpow-196.7%
*-commutative96.7%
Simplified96.7%
add-cube-cbrt96.7%
pow396.7%
pow-to-exp96.7%
pow1/396.7%
log-pow96.7%
pow-to-exp96.7%
add-log-exp96.7%
un-div-inv96.7%
Applied egg-rr96.7%
add-sqr-sqrt96.7%
times-frac98.4%
Applied egg-rr98.3%
associate-*l/98.4%
associate-*r/98.4%
add-sqr-sqrt98.4%
Applied egg-rr98.4%
Final simplification80.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (- 1.0 t_0)))
(if (<= x 2.8e-236)
t_1
(if (<= x 2.25e-186)
(/ (- (log x)) n)
(if (<= x 2.4e-118)
t_1
(if (<= x 0.00012) (/ (- x (log x)) n) (/ (/ t_0 n) x)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = 1.0 - t_0;
double tmp;
if (x <= 2.8e-236) {
tmp = t_1;
} else if (x <= 2.25e-186) {
tmp = -log(x) / n;
} else if (x <= 2.4e-118) {
tmp = t_1;
} else if (x <= 0.00012) {
tmp = (x - log(x)) / n;
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = 1.0d0 - t_0
if (x <= 2.8d-236) then
tmp = t_1
else if (x <= 2.25d-186) then
tmp = -log(x) / n
else if (x <= 2.4d-118) then
tmp = t_1
else if (x <= 0.00012d0) then
tmp = (x - log(x)) / n
else
tmp = (t_0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = 1.0 - t_0;
double tmp;
if (x <= 2.8e-236) {
tmp = t_1;
} else if (x <= 2.25e-186) {
tmp = -Math.log(x) / n;
} else if (x <= 2.4e-118) {
tmp = t_1;
} else if (x <= 0.00012) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = 1.0 - t_0 tmp = 0 if x <= 2.8e-236: tmp = t_1 elif x <= 2.25e-186: tmp = -math.log(x) / n elif x <= 2.4e-118: tmp = t_1 elif x <= 0.00012: tmp = (x - math.log(x)) / n else: tmp = (t_0 / n) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(1.0 - t_0) tmp = 0.0 if (x <= 2.8e-236) tmp = t_1; elseif (x <= 2.25e-186) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 2.4e-118) tmp = t_1; elseif (x <= 0.00012) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(t_0 / n) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = 1.0 - t_0; tmp = 0.0; if (x <= 2.8e-236) tmp = t_1; elseif (x <= 2.25e-186) tmp = -log(x) / n; elseif (x <= 2.4e-118) tmp = t_1; elseif (x <= 0.00012) tmp = (x - log(x)) / n; else tmp = (t_0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - t$95$0), $MachinePrecision]}, If[LessEqual[x, 2.8e-236], t$95$1, If[LessEqual[x, 2.25e-186], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 2.4e-118], t$95$1, If[LessEqual[x, 0.00012], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := 1 - t_0\\
\mathbf{if}\;x \leq 2.8 \cdot 10^{-236}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.25 \cdot 10^{-186}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{-118}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 0.00012:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_0}{n}}{x}\\
\end{array}
\end{array}
if x < 2.79999999999999986e-236 or 2.2499999999999999e-186 < x < 2.4000000000000001e-118Initial program 69.4%
Taylor expanded in x around 0 69.4%
*-rgt-identity69.4%
associate-*r/69.4%
unpow-169.4%
exp-to-pow69.4%
unpow-169.4%
Simplified69.4%
if 2.79999999999999986e-236 < x < 2.2499999999999999e-186Initial program 30.7%
Taylor expanded in n around inf 61.6%
log1p-def61.6%
Simplified61.6%
Taylor expanded in x around 0 61.6%
neg-mul-161.6%
Simplified61.6%
if 2.4000000000000001e-118 < x < 1.20000000000000003e-4Initial program 32.6%
Taylor expanded in n around inf 59.3%
log1p-def59.3%
Simplified59.3%
Taylor expanded in x around 0 59.2%
neg-mul-159.2%
unsub-neg59.2%
Simplified59.2%
if 1.20000000000000003e-4 < x Initial program 64.3%
Taylor expanded in x around inf 96.7%
log-rec96.7%
mul-1-neg96.7%
mul-1-neg96.7%
distribute-frac-neg96.7%
neg-mul-196.7%
remove-double-neg96.7%
*-rgt-identity96.7%
associate-*r/96.7%
unpow-196.7%
exp-to-pow96.7%
unpow-196.7%
*-commutative96.7%
Simplified96.7%
add-cube-cbrt96.7%
pow396.7%
pow-to-exp96.7%
pow1/396.7%
log-pow96.7%
pow-to-exp96.7%
add-log-exp96.7%
un-div-inv96.7%
Applied egg-rr96.7%
add-sqr-sqrt96.7%
times-frac98.4%
Applied egg-rr98.3%
associate-*l/98.4%
associate-*r/98.4%
add-sqr-sqrt98.4%
Applied egg-rr98.4%
Final simplification80.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= x 1.9e-236)
(- 1.0 t_0)
(if (<= x 4.8e-186)
(/ (- (log x)) n)
(if (<= x 2.2e-118)
(- (+ 1.0 (/ x n)) t_0)
(if (<= x 0.00023) (/ (- x (log x)) n) (/ (/ t_0 n) x)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (x <= 1.9e-236) {
tmp = 1.0 - t_0;
} else if (x <= 4.8e-186) {
tmp = -log(x) / n;
} else if (x <= 2.2e-118) {
tmp = (1.0 + (x / n)) - t_0;
} else if (x <= 0.00023) {
tmp = (x - log(x)) / n;
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if (x <= 1.9d-236) then
tmp = 1.0d0 - t_0
else if (x <= 4.8d-186) then
tmp = -log(x) / n
else if (x <= 2.2d-118) then
tmp = (1.0d0 + (x / n)) - t_0
else if (x <= 0.00023d0) then
tmp = (x - log(x)) / n
else
tmp = (t_0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= 1.9e-236) {
tmp = 1.0 - t_0;
} else if (x <= 4.8e-186) {
tmp = -Math.log(x) / n;
} else if (x <= 2.2e-118) {
tmp = (1.0 + (x / n)) - t_0;
} else if (x <= 0.00023) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if x <= 1.9e-236: tmp = 1.0 - t_0 elif x <= 4.8e-186: tmp = -math.log(x) / n elif x <= 2.2e-118: tmp = (1.0 + (x / n)) - t_0 elif x <= 0.00023: tmp = (x - math.log(x)) / n else: tmp = (t_0 / n) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= 1.9e-236) tmp = Float64(1.0 - t_0); elseif (x <= 4.8e-186) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 2.2e-118) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); elseif (x <= 0.00023) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(t_0 / n) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if (x <= 1.9e-236) tmp = 1.0 - t_0; elseif (x <= 4.8e-186) tmp = -log(x) / n; elseif (x <= 2.2e-118) tmp = (1.0 + (x / n)) - t_0; elseif (x <= 0.00023) tmp = (x - log(x)) / n; else tmp = (t_0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 1.9e-236], N[(1.0 - t$95$0), $MachinePrecision], If[LessEqual[x, 4.8e-186], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 2.2e-118], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 0.00023], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 1.9 \cdot 10^{-236}:\\
\;\;\;\;1 - t_0\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{-186}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{-118}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{elif}\;x \leq 0.00023:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_0}{n}}{x}\\
\end{array}
\end{array}
if x < 1.9e-236Initial program 64.4%
Taylor expanded in x around 0 64.4%
*-rgt-identity64.4%
associate-*r/64.4%
unpow-164.4%
exp-to-pow64.4%
unpow-164.4%
Simplified64.4%
if 1.9e-236 < x < 4.80000000000000006e-186Initial program 30.7%
Taylor expanded in n around inf 61.6%
log1p-def61.6%
Simplified61.6%
Taylor expanded in x around 0 61.6%
neg-mul-161.6%
Simplified61.6%
if 4.80000000000000006e-186 < x < 2.19999999999999984e-118Initial program 73.5%
Taylor expanded in x around 0 75.1%
if 2.19999999999999984e-118 < x < 2.3000000000000001e-4Initial program 32.6%
Taylor expanded in n around inf 59.3%
log1p-def59.3%
Simplified59.3%
Taylor expanded in x around 0 59.2%
neg-mul-159.2%
unsub-neg59.2%
Simplified59.2%
if 2.3000000000000001e-4 < x Initial program 64.3%
Taylor expanded in x around inf 96.7%
log-rec96.7%
mul-1-neg96.7%
mul-1-neg96.7%
distribute-frac-neg96.7%
neg-mul-196.7%
remove-double-neg96.7%
*-rgt-identity96.7%
associate-*r/96.7%
unpow-196.7%
exp-to-pow96.7%
unpow-196.7%
*-commutative96.7%
Simplified96.7%
add-cube-cbrt96.7%
pow396.7%
pow-to-exp96.7%
pow1/396.7%
log-pow96.7%
pow-to-exp96.7%
add-log-exp96.7%
un-div-inv96.7%
Applied egg-rr96.7%
add-sqr-sqrt96.7%
times-frac98.4%
Applied egg-rr98.3%
associate-*l/98.4%
associate-*r/98.4%
add-sqr-sqrt98.4%
Applied egg-rr98.4%
Final simplification80.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= x 1.25e-235)
t_0
(if (<= x 4.2e-186)
(/ (- (log x)) n)
(if (<= x 2.5e-118)
t_0
(if (<= x 1.0)
(/ (- x (log x)) n)
(/ (- (/ 1.0 x) (/ 0.5 (* x x))) n)))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if (x <= 1.25e-235) {
tmp = t_0;
} else if (x <= 4.2e-186) {
tmp = -log(x) / n;
} else if (x <= 2.5e-118) {
tmp = t_0;
} else if (x <= 1.0) {
tmp = (x - log(x)) / n;
} else {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
if (x <= 1.25d-235) then
tmp = t_0
else if (x <= 4.2d-186) then
tmp = -log(x) / n
else if (x <= 2.5d-118) then
tmp = t_0
else if (x <= 1.0d0) then
tmp = (x - log(x)) / n
else
tmp = ((1.0d0 / x) - (0.5d0 / (x * x))) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 - Math.pow(x, (1.0 / n));
double tmp;
if (x <= 1.25e-235) {
tmp = t_0;
} else if (x <= 4.2e-186) {
tmp = -Math.log(x) / n;
} else if (x <= 2.5e-118) {
tmp = t_0;
} else if (x <= 1.0) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if x <= 1.25e-235: tmp = t_0 elif x <= 4.2e-186: tmp = -math.log(x) / n elif x <= 2.5e-118: tmp = t_0 elif x <= 1.0: tmp = (x - math.log(x)) / n else: tmp = ((1.0 / x) - (0.5 / (x * x))) / n return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (x <= 1.25e-235) tmp = t_0; elseif (x <= 4.2e-186) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 2.5e-118) tmp = t_0; elseif (x <= 1.0) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if (x <= 1.25e-235) tmp = t_0; elseif (x <= 4.2e-186) tmp = -log(x) / n; elseif (x <= 2.5e-118) tmp = t_0; elseif (x <= 1.0) tmp = (x - log(x)) / n; else tmp = ((1.0 / x) - (0.5 / (x * x))) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.25e-235], t$95$0, If[LessEqual[x, 4.2e-186], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 2.5e-118], t$95$0, If[LessEqual[x, 1.0], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 1.25 \cdot 10^{-235}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{-186}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-118}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\
\end{array}
\end{array}
if x < 1.2499999999999999e-235 or 4.2000000000000004e-186 < x < 2.50000000000000007e-118Initial program 69.4%
Taylor expanded in x around 0 69.4%
*-rgt-identity69.4%
associate-*r/69.4%
unpow-169.4%
exp-to-pow69.4%
unpow-169.4%
Simplified69.4%
if 1.2499999999999999e-235 < x < 4.2000000000000004e-186Initial program 30.7%
Taylor expanded in n around inf 61.6%
log1p-def61.6%
Simplified61.6%
Taylor expanded in x around 0 61.6%
neg-mul-161.6%
Simplified61.6%
if 2.50000000000000007e-118 < x < 1Initial program 34.9%
Taylor expanded in n around inf 57.5%
log1p-def57.5%
Simplified57.5%
Taylor expanded in x around 0 57.4%
neg-mul-157.4%
unsub-neg57.4%
Simplified57.4%
if 1 < x Initial program 63.7%
Taylor expanded in n around inf 64.0%
log1p-def64.0%
Simplified64.0%
Taylor expanded in x around inf 63.3%
associate-*r/63.3%
metadata-eval63.3%
unpow263.3%
Simplified63.3%
Final simplification63.1%
(FPCore (x n)
:precision binary64
(if (<= x 1.2e-187)
(/ (- (log x)) n)
(if (<= x 3.8e-137)
(/ 1.0 (* n x))
(if (<= x 0.98)
(/ (- x (log x)) n)
(/ (- (/ 1.0 x) (/ 0.5 (* x x))) n)))))
double code(double x, double n) {
double tmp;
if (x <= 1.2e-187) {
tmp = -log(x) / n;
} else if (x <= 3.8e-137) {
tmp = 1.0 / (n * x);
} else if (x <= 0.98) {
tmp = (x - log(x)) / n;
} else {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 1.2d-187) then
tmp = -log(x) / n
else if (x <= 3.8d-137) then
tmp = 1.0d0 / (n * x)
else if (x <= 0.98d0) then
tmp = (x - log(x)) / n
else
tmp = ((1.0d0 / x) - (0.5d0 / (x * x))) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.2e-187) {
tmp = -Math.log(x) / n;
} else if (x <= 3.8e-137) {
tmp = 1.0 / (n * x);
} else if (x <= 0.98) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.2e-187: tmp = -math.log(x) / n elif x <= 3.8e-137: tmp = 1.0 / (n * x) elif x <= 0.98: tmp = (x - math.log(x)) / n else: tmp = ((1.0 / x) - (0.5 / (x * x))) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 1.2e-187) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 3.8e-137) tmp = Float64(1.0 / Float64(n * x)); elseif (x <= 0.98) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.2e-187) tmp = -log(x) / n; elseif (x <= 3.8e-137) tmp = 1.0 / (n * x); elseif (x <= 0.98) tmp = (x - log(x)) / n; else tmp = ((1.0 / x) - (0.5 / (x * x))) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.2e-187], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 3.8e-137], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.98], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.2 \cdot 10^{-187}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{-137}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;x \leq 0.98:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\
\end{array}
\end{array}
if x < 1.20000000000000007e-187Initial program 49.3%
Taylor expanded in n around inf 51.5%
log1p-def51.5%
Simplified51.5%
Taylor expanded in x around 0 51.5%
neg-mul-151.5%
Simplified51.5%
if 1.20000000000000007e-187 < x < 3.79999999999999999e-137Initial program 79.4%
Taylor expanded in x around inf 69.1%
log-rec69.1%
mul-1-neg69.1%
mul-1-neg69.1%
distribute-frac-neg69.1%
neg-mul-169.1%
remove-double-neg69.1%
*-rgt-identity69.1%
associate-*r/69.1%
unpow-169.1%
exp-to-pow69.1%
unpow-169.1%
*-commutative69.1%
Simplified69.1%
Taylor expanded in n around inf 44.1%
*-commutative44.1%
Simplified44.1%
if 3.79999999999999999e-137 < x < 0.97999999999999998Initial program 36.5%
Taylor expanded in n around inf 55.4%
log1p-def55.4%
Simplified55.4%
Taylor expanded in x around 0 55.3%
neg-mul-155.3%
unsub-neg55.3%
Simplified55.3%
if 0.97999999999999998 < x Initial program 63.7%
Taylor expanded in n around inf 64.0%
log1p-def64.0%
Simplified64.0%
Taylor expanded in x around inf 63.3%
associate-*r/63.3%
metadata-eval63.3%
unpow263.3%
Simplified63.3%
Final simplification57.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- (log x)) n)))
(if (<= x 2.3e-187)
t_0
(if (<= x 3.7e-137)
(/ 1.0 (* n x))
(if (<= x 0.68) t_0 (/ (- (/ 1.0 x) (/ 0.5 (* x x))) n))))))
double code(double x, double n) {
double t_0 = -log(x) / n;
double tmp;
if (x <= 2.3e-187) {
tmp = t_0;
} else if (x <= 3.7e-137) {
tmp = 1.0 / (n * x);
} else if (x <= 0.68) {
tmp = t_0;
} else {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = -log(x) / n
if (x <= 2.3d-187) then
tmp = t_0
else if (x <= 3.7d-137) then
tmp = 1.0d0 / (n * x)
else if (x <= 0.68d0) then
tmp = t_0
else
tmp = ((1.0d0 / x) - (0.5d0 / (x * x))) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = -Math.log(x) / n;
double tmp;
if (x <= 2.3e-187) {
tmp = t_0;
} else if (x <= 3.7e-137) {
tmp = 1.0 / (n * x);
} else if (x <= 0.68) {
tmp = t_0;
} else {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
}
return tmp;
}
def code(x, n): t_0 = -math.log(x) / n tmp = 0 if x <= 2.3e-187: tmp = t_0 elif x <= 3.7e-137: tmp = 1.0 / (n * x) elif x <= 0.68: tmp = t_0 else: tmp = ((1.0 / x) - (0.5 / (x * x))) / n return tmp
function code(x, n) t_0 = Float64(Float64(-log(x)) / n) tmp = 0.0 if (x <= 2.3e-187) tmp = t_0; elseif (x <= 3.7e-137) tmp = Float64(1.0 / Float64(n * x)); elseif (x <= 0.68) tmp = t_0; else tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = -log(x) / n; tmp = 0.0; if (x <= 2.3e-187) tmp = t_0; elseif (x <= 3.7e-137) tmp = 1.0 / (n * x); elseif (x <= 0.68) tmp = t_0; else tmp = ((1.0 / x) - (0.5 / (x * x))) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[x, 2.3e-187], t$95$0, If[LessEqual[x, 3.7e-137], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.68], t$95$0, N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-\log x}{n}\\
\mathbf{if}\;x \leq 2.3 \cdot 10^{-187}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{-137}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;x \leq 0.68:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\
\end{array}
\end{array}
if x < 2.29999999999999998e-187 or 3.7e-137 < x < 0.680000000000000049Initial program 41.7%
Taylor expanded in n around inf 53.9%
log1p-def53.9%
Simplified53.9%
Taylor expanded in x around 0 53.3%
neg-mul-153.3%
Simplified53.3%
if 2.29999999999999998e-187 < x < 3.7e-137Initial program 79.4%
Taylor expanded in x around inf 69.1%
log-rec69.1%
mul-1-neg69.1%
mul-1-neg69.1%
distribute-frac-neg69.1%
neg-mul-169.1%
remove-double-neg69.1%
*-rgt-identity69.1%
associate-*r/69.1%
unpow-169.1%
exp-to-pow69.1%
unpow-169.1%
*-commutative69.1%
Simplified69.1%
Taylor expanded in n around inf 44.1%
*-commutative44.1%
Simplified44.1%
if 0.680000000000000049 < x Initial program 63.7%
Taylor expanded in n around inf 64.0%
log1p-def64.0%
Simplified64.0%
Taylor expanded in x around inf 63.3%
associate-*r/63.3%
metadata-eval63.3%
unpow263.3%
Simplified63.3%
Final simplification57.3%
(FPCore (x n) :precision binary64 (/ 1.0 (* n x)))
double code(double x, double n) {
return 1.0 / (n * x);
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = 1.0d0 / (n * x)
end function
public static double code(double x, double n) {
return 1.0 / (n * x);
}
def code(x, n): return 1.0 / (n * x)
function code(x, n) return Float64(1.0 / Float64(n * x)) end
function tmp = code(x, n) tmp = 1.0 / (n * x); end
code[x_, n_] := N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{n \cdot x}
\end{array}
Initial program 55.4%
Taylor expanded in x around inf 62.9%
log-rec62.9%
mul-1-neg62.9%
mul-1-neg62.9%
distribute-frac-neg62.9%
neg-mul-162.9%
remove-double-neg62.9%
*-rgt-identity62.9%
associate-*r/62.9%
unpow-162.9%
exp-to-pow62.9%
unpow-162.9%
*-commutative62.9%
Simplified62.9%
Taylor expanded in n around inf 41.1%
*-commutative41.1%
Simplified41.1%
Final simplification41.1%
(FPCore (x n) :precision binary64 (/ (/ 1.0 n) x))
double code(double x, double n) {
return (1.0 / n) / x;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 / n) / x
end function
public static double code(double x, double n) {
return (1.0 / n) / x;
}
def code(x, n): return (1.0 / n) / x
function code(x, n) return Float64(Float64(1.0 / n) / x) end
function tmp = code(x, n) tmp = (1.0 / n) / x; end
code[x_, n_] := N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{n}}{x}
\end{array}
Initial program 55.4%
Taylor expanded in x around inf 62.9%
log-rec62.9%
mul-1-neg62.9%
mul-1-neg62.9%
distribute-frac-neg62.9%
neg-mul-162.9%
remove-double-neg62.9%
*-rgt-identity62.9%
associate-*r/62.9%
unpow-162.9%
exp-to-pow62.9%
unpow-162.9%
*-commutative62.9%
Simplified62.9%
add-cube-cbrt62.9%
pow362.9%
pow-to-exp62.9%
pow1/362.9%
log-pow62.9%
pow-to-exp62.9%
add-log-exp62.9%
un-div-inv62.9%
Applied egg-rr62.9%
Taylor expanded in n around inf 41.1%
associate-/r*42.0%
Simplified42.0%
Final simplification42.0%
(FPCore (x n) :precision binary64 (/ x n))
double code(double x, double n) {
return x / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = x / n
end function
public static double code(double x, double n) {
return x / n;
}
def code(x, n): return x / n
function code(x, n) return Float64(x / n) end
function tmp = code(x, n) tmp = x / n; end
code[x_, n_] := N[(x / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{n}
\end{array}
Initial program 55.4%
Taylor expanded in x around inf 62.9%
log-rec62.9%
mul-1-neg62.9%
mul-1-neg62.9%
distribute-frac-neg62.9%
neg-mul-162.9%
remove-double-neg62.9%
*-rgt-identity62.9%
associate-*r/62.9%
unpow-162.9%
exp-to-pow62.9%
unpow-162.9%
*-commutative62.9%
Simplified62.9%
Taylor expanded in n around inf 41.1%
*-commutative41.1%
Simplified41.1%
expm1-log1p-u32.7%
expm1-udef24.1%
associate-/r*24.1%
add-exp-log24.1%
neg-log24.1%
add-sqr-sqrt3.9%
sqrt-unprod10.2%
sqr-neg10.2%
sqrt-unprod6.3%
add-sqr-sqrt8.2%
add-exp-log8.2%
Applied egg-rr8.2%
expm1-def3.5%
expm1-log1p4.3%
Simplified4.3%
Final simplification4.3%
herbie shell --seed 2023238
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))