
(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 21 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
(if (<= (/ 1.0 n) -2e-16)
(/ (pow x (/ 2.0 (* n 2.0))) (* n x))
(if (<= (/ 1.0 n) 2e-69)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 0.02)
(/ (pow E (/ (log x) n)) (* n x))
(- (exp (/ x n)) (pow x (reciprocal n)))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-16}:\\
\;\;\;\;\frac{{x}^{\left(\frac{2}{n \cdot 2}\right)}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-69}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.02:\\
\;\;\;\;\frac{{e}^{\left(\frac{\log x}{n}\right)}}{n \cdot x}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - {x}^{\mathsf{reciprocal}\left(n\right)}\\
\end{array}
\end{array}
if (/.f64 1 n) < -2e-16Initial program 94.6%
reciprocal-define94.6%
reciprocal-define94.6%
Simplified94.6%
Taylor expanded in x around inf 99.9%
mul-1-neg99.9%
log-rec99.9%
mul-1-neg99.9%
distribute-neg-frac99.9%
mul-1-neg99.9%
remove-double-neg99.9%
Simplified99.9%
expm1-log1p-u100.0%
expm1-udef100.0%
log1p-udef99.9%
add-exp-log99.9%
div-inv99.9%
reciprocal-undefine99.0%
pow-to-exp99.0%
Applied egg-rr99.0%
add-exp-log99.0%
log1p-udef99.0%
expm1-udef99.0%
expm1-log1p-u99.0%
sqr-pow99.0%
pow-prod-up99.0%
reciprocal-undefine99.0%
associate-/l/99.0%
reciprocal-define99.0%
reciprocal-undefine99.0%
associate-/l/99.0%
reciprocal-define99.0%
Applied egg-rr99.0%
count-299.0%
reciprocal-undefine99.9%
associate-*r/99.9%
metadata-eval99.9%
*-commutative99.9%
Simplified99.9%
if -2e-16 < (/.f64 1 n) < 1.9999999999999999e-69Initial program 33.5%
reciprocal-define33.5%
reciprocal-define33.5%
Simplified33.5%
Taylor expanded in n around inf 86.1%
+-rgt-identity86.1%
+-rgt-identity86.1%
log1p-def86.1%
Simplified86.1%
if 1.9999999999999999e-69 < (/.f64 1 n) < 0.0200000000000000004Initial program 23.2%
reciprocal-define22.7%
reciprocal-define12.8%
Simplified12.8%
Taylor expanded in x around inf 67.8%
mul-1-neg67.8%
log-rec67.8%
mul-1-neg67.8%
distribute-neg-frac67.8%
mul-1-neg67.8%
remove-double-neg67.8%
Simplified67.8%
*-un-lft-identity67.8%
exp-prod68.0%
Applied egg-rr68.0%
if 0.0200000000000000004 < (/.f64 1 n) Initial program 58.6%
reciprocal-define58.6%
reciprocal-define58.6%
Simplified58.6%
Taylor expanded in n around 0 58.6%
log1p-def99.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
Final simplification91.2%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -2e-16)
(/ (pow x (/ 2.0 (* n 2.0))) (* n x))
(if (<= (/ 1.0 n) 2e-69)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 0.02)
(/ (cbrt (pow x (/ 3.0 n))) (* n x))
(- (exp (/ x n)) (pow x (reciprocal n)))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-16}:\\
\;\;\;\;\frac{{x}^{\left(\frac{2}{n \cdot 2}\right)}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-69}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.02:\\
\;\;\;\;\frac{\sqrt[3]{{x}^{\left(\frac{3}{n}\right)}}}{n \cdot x}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - {x}^{\mathsf{reciprocal}\left(n\right)}\\
\end{array}
\end{array}
if (/.f64 1 n) < -2e-16Initial program 94.6%
reciprocal-define94.6%
reciprocal-define94.6%
Simplified94.6%
Taylor expanded in x around inf 99.9%
mul-1-neg99.9%
log-rec99.9%
mul-1-neg99.9%
distribute-neg-frac99.9%
mul-1-neg99.9%
remove-double-neg99.9%
Simplified99.9%
expm1-log1p-u100.0%
expm1-udef100.0%
log1p-udef99.9%
add-exp-log99.9%
div-inv99.9%
reciprocal-undefine99.0%
pow-to-exp99.0%
Applied egg-rr99.0%
add-exp-log99.0%
log1p-udef99.0%
expm1-udef99.0%
expm1-log1p-u99.0%
sqr-pow99.0%
pow-prod-up99.0%
reciprocal-undefine99.0%
associate-/l/99.0%
reciprocal-define99.0%
reciprocal-undefine99.0%
associate-/l/99.0%
reciprocal-define99.0%
Applied egg-rr99.0%
count-299.0%
reciprocal-undefine99.9%
associate-*r/99.9%
metadata-eval99.9%
*-commutative99.9%
Simplified99.9%
if -2e-16 < (/.f64 1 n) < 1.9999999999999999e-69Initial program 33.5%
reciprocal-define33.5%
reciprocal-define33.5%
Simplified33.5%
Taylor expanded in n around inf 86.1%
+-rgt-identity86.1%
+-rgt-identity86.1%
log1p-def86.1%
Simplified86.1%
if 1.9999999999999999e-69 < (/.f64 1 n) < 0.0200000000000000004Initial program 23.2%
reciprocal-define22.7%
reciprocal-define12.8%
Simplified12.8%
Taylor expanded in x around inf 67.8%
mul-1-neg67.8%
log-rec67.8%
mul-1-neg67.8%
distribute-neg-frac67.8%
mul-1-neg67.8%
remove-double-neg67.8%
Simplified67.8%
expm1-log1p-u67.8%
expm1-udef67.8%
log1p-udef67.8%
add-exp-log67.8%
div-inv67.8%
reciprocal-undefine60.7%
pow-to-exp60.7%
Applied egg-rr60.7%
add-exp-log60.7%
log1p-udef60.7%
expm1-udef60.7%
expm1-log1p-u60.7%
add-cbrt-cube60.7%
pow1/360.7%
pow360.7%
pow-pow60.7%
Applied egg-rr60.7%
unpow1/360.7%
*-commutative60.7%
reciprocal-define67.9%
associate-*r/67.9%
metadata-eval67.9%
Simplified67.9%
if 0.0200000000000000004 < (/.f64 1 n) Initial program 58.6%
reciprocal-define58.6%
reciprocal-define58.6%
Simplified58.6%
Taylor expanded in n around 0 58.6%
log1p-def99.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
Final simplification91.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (pow x (/ 2.0 (* n 2.0))) (* n x))))
(if (<= (/ 1.0 n) -2e-16)
t_0
(if (<= (/ 1.0 n) 2e-69)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 0.02)
t_0
(- (exp (/ x n)) (pow x (reciprocal n))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{x}^{\left(\frac{2}{n \cdot 2}\right)}}{n \cdot x}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-16}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-69}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.02:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - {x}^{\mathsf{reciprocal}\left(n\right)}\\
\end{array}
\end{array}
if (/.f64 1 n) < -2e-16 or 1.9999999999999999e-69 < (/.f64 1 n) < 0.0200000000000000004Initial program 82.2%
reciprocal-define82.1%
reciprocal-define80.4%
Simplified80.4%
Taylor expanded in x around inf 94.3%
mul-1-neg94.3%
log-rec94.3%
mul-1-neg94.3%
distribute-neg-frac94.3%
mul-1-neg94.3%
remove-double-neg94.3%
Simplified94.3%
expm1-log1p-u94.3%
expm1-udef94.3%
log1p-udef94.3%
add-exp-log94.3%
div-inv94.3%
reciprocal-undefine92.3%
pow-to-exp92.3%
Applied egg-rr92.3%
add-exp-log92.3%
log1p-udef92.3%
expm1-udef92.3%
expm1-log1p-u92.3%
sqr-pow92.3%
pow-prod-up92.3%
reciprocal-undefine92.4%
associate-/l/92.4%
reciprocal-define92.3%
reciprocal-undefine92.4%
associate-/l/92.4%
reciprocal-define92.3%
Applied egg-rr92.3%
count-292.3%
reciprocal-undefine94.3%
associate-*r/94.3%
metadata-eval94.3%
*-commutative94.3%
Simplified94.3%
if -2e-16 < (/.f64 1 n) < 1.9999999999999999e-69Initial program 33.5%
reciprocal-define33.5%
reciprocal-define33.5%
Simplified33.5%
Taylor expanded in n around inf 86.1%
+-rgt-identity86.1%
+-rgt-identity86.1%
log1p-def86.1%
Simplified86.1%
if 0.0200000000000000004 < (/.f64 1 n) Initial program 58.6%
reciprocal-define58.6%
reciprocal-define58.6%
Simplified58.6%
Taylor expanded in n around 0 58.6%
log1p-def99.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
Final simplification91.2%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -2e-16)
(/ (pow x (/ 2.0 (* n 2.0))) (* n x))
(if (<= (/ 1.0 n) 2e-69)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 5e-21)
(pow (* n (+ x 0.5)) -1.0)
(if (<= (/ 1.0 n) 4e+149)
(- 1.0 (pow x (/ 1.0 n)))
(/ (reciprocal (pow x (reciprocal n))) (* n x)))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-16}:\\
\;\;\;\;\frac{{x}^{\left(\frac{2}{n \cdot 2}\right)}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-69}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-21}:\\
\;\;\;\;{\left(n \cdot \left(x + 0.5\right)\right)}^{-1}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+149}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{reciprocal}\left(\left({x}^{\mathsf{reciprocal}\left(n\right)}\right)\right)}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -2e-16Initial program 94.6%
reciprocal-define94.6%
reciprocal-define94.6%
Simplified94.6%
Taylor expanded in x around inf 99.9%
mul-1-neg99.9%
log-rec99.9%
mul-1-neg99.9%
distribute-neg-frac99.9%
mul-1-neg99.9%
remove-double-neg99.9%
Simplified99.9%
expm1-log1p-u100.0%
expm1-udef100.0%
log1p-udef99.9%
add-exp-log99.9%
div-inv99.9%
reciprocal-undefine99.0%
pow-to-exp99.0%
Applied egg-rr99.0%
add-exp-log99.0%
log1p-udef99.0%
expm1-udef99.0%
expm1-log1p-u99.0%
sqr-pow99.0%
pow-prod-up99.0%
reciprocal-undefine99.0%
associate-/l/99.0%
reciprocal-define99.0%
reciprocal-undefine99.0%
associate-/l/99.0%
reciprocal-define99.0%
Applied egg-rr99.0%
count-299.0%
reciprocal-undefine99.9%
associate-*r/99.9%
metadata-eval99.9%
*-commutative99.9%
Simplified99.9%
if -2e-16 < (/.f64 1 n) < 1.9999999999999999e-69Initial program 33.5%
reciprocal-define33.5%
reciprocal-define33.5%
Simplified33.5%
Taylor expanded in n around inf 86.1%
+-rgt-identity86.1%
+-rgt-identity86.1%
log1p-def86.1%
Simplified86.1%
if 1.9999999999999999e-69 < (/.f64 1 n) < 4.99999999999999973e-21Initial program 6.4%
reciprocal-define6.4%
reciprocal-define6.4%
Simplified6.4%
Taylor expanded in n around inf 25.6%
+-rgt-identity25.6%
+-rgt-identity25.6%
log1p-def25.6%
Simplified25.6%
clear-num25.5%
inv-pow25.5%
Applied egg-rr25.5%
Taylor expanded in x around inf 82.5%
*-commutative82.5%
distribute-lft-out82.5%
Simplified82.5%
if 4.99999999999999973e-21 < (/.f64 1 n) < 4.0000000000000002e149Initial program 77.5%
reciprocal-define77.3%
reciprocal-define72.5%
Simplified72.5%
Taylor expanded in x around 0 69.2%
Taylor expanded in n around 0 74.2%
if 4.0000000000000002e149 < (/.f64 1 n) Initial program 25.5%
reciprocal-define25.5%
reciprocal-define25.5%
Simplified25.5%
Taylor expanded in x around inf 0.3%
mul-1-neg0.3%
log-rec0.3%
mul-1-neg0.3%
distribute-neg-frac0.3%
mul-1-neg0.3%
remove-double-neg0.3%
Simplified0.3%
add-sqr-sqrt0.0%
sqrt-unprod78.5%
sqr-neg78.5%
distribute-frac-neg78.5%
distribute-frac-neg78.5%
sqrt-unprod78.5%
add-sqr-sqrt78.5%
distribute-frac-neg78.5%
exp-neg78.5%
div-inv78.5%
reciprocal-undefine78.5%
pow-to-exp78.5%
Applied egg-rr78.5%
reciprocal-define78.5%
Simplified78.5%
Final simplification87.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (/ 1.0 x) n)))
(if (<= (/ 1.0 n) -5000.0)
(- 1.0 (pow x (reciprocal n)))
(if (<= (/ 1.0 n) -2e-134)
(/ (- x (log x)) n)
(if (<= (/ 1.0 n) -5e-251)
t_0
(if (<= (/ 1.0 n) 2e-69)
(- (/ (log x) n))
(if (<= (/ 1.0 n) 5e-21)
t_0
(if (<= (/ 1.0 n) 5e+193)
(- 1.0 (pow x (/ 1.0 n)))
(reciprocal (* n x))))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{1}{x}}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -5000:\\
\;\;\;\;1 - {x}^{\mathsf{reciprocal}\left(n\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-134}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-251}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-69}:\\
\;\;\;\;-\frac{\log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-21}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+193}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{reciprocal}\left(\left(n \cdot x\right)\right)\\
\end{array}
\end{array}
if (/.f64 1 n) < -5e3Initial program 100.0%
reciprocal-define100.0%
reciprocal-define100.0%
Simplified100.0%
Taylor expanded in x around 0 56.6%
if -5e3 < (/.f64 1 n) < -2.00000000000000008e-134Initial program 14.3%
reciprocal-define14.3%
reciprocal-define14.3%
Simplified14.3%
Taylor expanded in n around inf 73.6%
+-rgt-identity73.6%
+-rgt-identity73.6%
log1p-def73.7%
Simplified73.7%
Taylor expanded in x around 0 59.7%
neg-mul-159.7%
sub-neg59.7%
Simplified59.7%
if -2.00000000000000008e-134 < (/.f64 1 n) < -5.0000000000000003e-251 or 1.9999999999999999e-69 < (/.f64 1 n) < 4.99999999999999973e-21Initial program 38.7%
reciprocal-define38.7%
reciprocal-define38.7%
Simplified38.7%
Taylor expanded in n around inf 65.8%
+-rgt-identity65.8%
+-rgt-identity65.8%
log1p-def65.9%
Simplified65.9%
Taylor expanded in x around inf 73.1%
if -5.0000000000000003e-251 < (/.f64 1 n) < 1.9999999999999999e-69Initial program 30.3%
reciprocal-define30.3%
reciprocal-define30.3%
Simplified30.3%
Taylor expanded in x around 0 30.3%
Taylor expanded in n around inf 64.7%
neg-mul-164.7%
distribute-neg-frac64.7%
Simplified64.7%
if 4.99999999999999973e-21 < (/.f64 1 n) < 4.99999999999999972e193Initial program 76.7%
reciprocal-define76.5%
reciprocal-define72.1%
Simplified72.1%
Taylor expanded in x around 0 66.2%
Taylor expanded in n around 0 70.8%
if 4.99999999999999972e193 < (/.f64 1 n) Initial program 17.1%
reciprocal-define17.1%
reciprocal-define17.1%
Simplified17.1%
Taylor expanded in x around inf 0.1%
mul-1-neg0.1%
log-rec0.1%
mul-1-neg0.1%
distribute-neg-frac0.1%
mul-1-neg0.1%
remove-double-neg0.1%
Simplified0.1%
Taylor expanded in n around inf 74.6%
associate-/r*74.6%
reciprocal-define74.6%
Simplified74.6%
reciprocal-undefine74.6%
associate-/r*74.6%
reciprocal-define74.6%
*-commutative74.6%
Applied egg-rr74.6%
Final simplification65.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow (* n (+ x 0.5)) -1.0)))
(if (<= (/ 1.0 n) -5000.0)
(- 1.0 (pow x (reciprocal n)))
(if (<= (/ 1.0 n) -2e-134)
(/ (- x (log x)) n)
(if (<= (/ 1.0 n) -2e-283)
t_0
(if (<= (/ 1.0 n) 2e-69)
(- (/ (log x) n))
(if (<= (/ 1.0 n) 5e-21)
t_0
(if (<= (/ 1.0 n) 5e+193)
(- 1.0 (pow x (/ 1.0 n)))
(reciprocal (* n x))))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(n \cdot \left(x + 0.5\right)\right)}^{-1}\\
\mathbf{if}\;\frac{1}{n} \leq -5000:\\
\;\;\;\;1 - {x}^{\mathsf{reciprocal}\left(n\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-134}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-283}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-69}:\\
\;\;\;\;-\frac{\log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-21}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+193}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{reciprocal}\left(\left(n \cdot x\right)\right)\\
\end{array}
\end{array}
if (/.f64 1 n) < -5e3Initial program 100.0%
reciprocal-define100.0%
reciprocal-define100.0%
Simplified100.0%
Taylor expanded in x around 0 56.6%
if -5e3 < (/.f64 1 n) < -2.00000000000000008e-134Initial program 14.3%
reciprocal-define14.3%
reciprocal-define14.3%
Simplified14.3%
Taylor expanded in n around inf 73.6%
+-rgt-identity73.6%
+-rgt-identity73.6%
log1p-def73.7%
Simplified73.7%
Taylor expanded in x around 0 59.7%
neg-mul-159.7%
sub-neg59.7%
Simplified59.7%
if -2.00000000000000008e-134 < (/.f64 1 n) < -1.99999999999999989e-283 or 1.9999999999999999e-69 < (/.f64 1 n) < 4.99999999999999973e-21Initial program 40.9%
reciprocal-define40.9%
reciprocal-define40.9%
Simplified40.9%
Taylor expanded in n around inf 70.8%
+-rgt-identity70.8%
+-rgt-identity70.8%
log1p-def70.8%
Simplified70.8%
clear-num70.8%
inv-pow70.8%
Applied egg-rr70.8%
Taylor expanded in x around inf 72.2%
*-commutative72.2%
distribute-lft-out72.2%
Simplified72.2%
if -1.99999999999999989e-283 < (/.f64 1 n) < 1.9999999999999999e-69Initial program 27.4%
reciprocal-define27.4%
reciprocal-define27.4%
Simplified27.4%
Taylor expanded in x around 0 27.4%
Taylor expanded in n around inf 66.1%
neg-mul-166.1%
distribute-neg-frac66.1%
Simplified66.1%
if 4.99999999999999973e-21 < (/.f64 1 n) < 4.99999999999999972e193Initial program 76.7%
reciprocal-define76.5%
reciprocal-define72.1%
Simplified72.1%
Taylor expanded in x around 0 66.2%
Taylor expanded in n around 0 70.8%
if 4.99999999999999972e193 < (/.f64 1 n) Initial program 17.1%
reciprocal-define17.1%
reciprocal-define17.1%
Simplified17.1%
Taylor expanded in x around inf 0.1%
mul-1-neg0.1%
log-rec0.1%
mul-1-neg0.1%
distribute-neg-frac0.1%
mul-1-neg0.1%
remove-double-neg0.1%
Simplified0.1%
Taylor expanded in n around inf 74.6%
associate-/r*74.6%
reciprocal-define74.6%
Simplified74.6%
reciprocal-undefine74.6%
associate-/r*74.6%
reciprocal-define74.6%
*-commutative74.6%
Applied egg-rr74.6%
Final simplification65.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow (* n (+ x 0.5)) -1.0)))
(if (<= (/ 1.0 n) -2e-16)
(/ (pow x (reciprocal n)) (* n x))
(if (<= (/ 1.0 n) -2e-134)
(/ (- x (log x)) n)
(if (<= (/ 1.0 n) -2e-283)
t_0
(if (<= (/ 1.0 n) 2e-69)
(- (/ (log x) n))
(if (<= (/ 1.0 n) 5e-21)
t_0
(if (<= (/ 1.0 n) 5e+193)
(- 1.0 (pow x (/ 1.0 n)))
(reciprocal (* n x))))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(n \cdot \left(x + 0.5\right)\right)}^{-1}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-16}:\\
\;\;\;\;\frac{{x}^{\mathsf{reciprocal}\left(n\right)}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-134}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-283}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-69}:\\
\;\;\;\;-\frac{\log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-21}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+193}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{reciprocal}\left(\left(n \cdot x\right)\right)\\
\end{array}
\end{array}
if (/.f64 1 n) < -2e-16Initial program 94.6%
reciprocal-define94.6%
reciprocal-define94.6%
Simplified94.6%
Taylor expanded in x around inf 99.9%
mul-1-neg99.9%
log-rec99.9%
mul-1-neg99.9%
distribute-neg-frac99.9%
mul-1-neg99.9%
remove-double-neg99.9%
Simplified99.9%
*-un-lft-identity99.9%
times-frac100.0%
remove-double-neg100.0%
distribute-frac-neg100.0%
reciprocal-undefine96.6%
distribute-frac-neg96.6%
remove-double-neg96.6%
div-inv96.6%
reciprocal-undefine96.7%
pow-to-exp96.7%
Applied egg-rr96.7%
reciprocal-define99.0%
times-frac99.0%
*-lft-identity99.0%
*-commutative99.0%
Simplified99.0%
if -2e-16 < (/.f64 1 n) < -2.00000000000000008e-134Initial program 16.7%
reciprocal-define16.7%
reciprocal-define16.7%
Simplified16.7%
Taylor expanded in n around inf 89.9%
+-rgt-identity89.9%
+-rgt-identity89.9%
log1p-def90.0%
Simplified90.0%
Taylor expanded in x around 0 72.9%
neg-mul-172.9%
sub-neg72.9%
Simplified72.9%
if -2.00000000000000008e-134 < (/.f64 1 n) < -1.99999999999999989e-283 or 1.9999999999999999e-69 < (/.f64 1 n) < 4.99999999999999973e-21Initial program 40.9%
reciprocal-define40.9%
reciprocal-define40.9%
Simplified40.9%
Taylor expanded in n around inf 70.8%
+-rgt-identity70.8%
+-rgt-identity70.8%
log1p-def70.8%
Simplified70.8%
clear-num70.8%
inv-pow70.8%
Applied egg-rr70.8%
Taylor expanded in x around inf 72.2%
*-commutative72.2%
distribute-lft-out72.2%
Simplified72.2%
if -1.99999999999999989e-283 < (/.f64 1 n) < 1.9999999999999999e-69Initial program 27.4%
reciprocal-define27.4%
reciprocal-define27.4%
Simplified27.4%
Taylor expanded in x around 0 27.4%
Taylor expanded in n around inf 66.1%
neg-mul-166.1%
distribute-neg-frac66.1%
Simplified66.1%
if 4.99999999999999973e-21 < (/.f64 1 n) < 4.99999999999999972e193Initial program 76.7%
reciprocal-define76.5%
reciprocal-define72.1%
Simplified72.1%
Taylor expanded in x around 0 66.2%
Taylor expanded in n around 0 70.8%
if 4.99999999999999972e193 < (/.f64 1 n) Initial program 17.1%
reciprocal-define17.1%
reciprocal-define17.1%
Simplified17.1%
Taylor expanded in x around inf 0.1%
mul-1-neg0.1%
log-rec0.1%
mul-1-neg0.1%
distribute-neg-frac0.1%
mul-1-neg0.1%
remove-double-neg0.1%
Simplified0.1%
Taylor expanded in n around inf 74.6%
associate-/r*74.6%
reciprocal-define74.6%
Simplified74.6%
reciprocal-undefine74.6%
associate-/r*74.6%
reciprocal-define74.6%
*-commutative74.6%
Applied egg-rr74.6%
Final simplification78.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (/ 1.0 x) n))
(t_1 (- 1.0 (pow x (reciprocal n))))
(t_2 (- (/ (log x) n))))
(if (<= (/ 1.0 n) -0.0005)
t_1
(if (<= (/ 1.0 n) -2e-134)
t_2
(if (<= (/ 1.0 n) -5e-251)
t_0
(if (<= (/ 1.0 n) 2e-69)
t_2
(if (<= (/ 1.0 n) 5e-21)
t_0
(if (<= (/ 1.0 n) 5e+193) t_1 (reciprocal (* n x))))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{1}{x}}{n}\\
t_1 := 1 - {x}^{\mathsf{reciprocal}\left(n\right)}\\
t_2 := -\frac{\log x}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -0.0005:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-134}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-251}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-69}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-21}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+193}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{reciprocal}\left(\left(n \cdot x\right)\right)\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.0000000000000001e-4 or 4.99999999999999973e-21 < (/.f64 1 n) < 4.99999999999999972e193Initial program 91.3%
reciprocal-define91.2%
reciprocal-define89.8%
Simplified89.8%
Taylor expanded in x around 0 59.3%
if -5.0000000000000001e-4 < (/.f64 1 n) < -2.00000000000000008e-134 or -5.0000000000000003e-251 < (/.f64 1 n) < 1.9999999999999999e-69Initial program 27.0%
reciprocal-define27.0%
reciprocal-define27.0%
Simplified27.0%
Taylor expanded in x around 0 26.9%
Taylor expanded in n around inf 64.1%
neg-mul-164.1%
distribute-neg-frac64.1%
Simplified64.1%
if -2.00000000000000008e-134 < (/.f64 1 n) < -5.0000000000000003e-251 or 1.9999999999999999e-69 < (/.f64 1 n) < 4.99999999999999973e-21Initial program 38.7%
reciprocal-define38.7%
reciprocal-define38.7%
Simplified38.7%
Taylor expanded in n around inf 65.8%
+-rgt-identity65.8%
+-rgt-identity65.8%
log1p-def65.9%
Simplified65.9%
Taylor expanded in x around inf 73.1%
if 4.99999999999999972e193 < (/.f64 1 n) Initial program 17.1%
reciprocal-define17.1%
reciprocal-define17.1%
Simplified17.1%
Taylor expanded in x around inf 0.1%
mul-1-neg0.1%
log-rec0.1%
mul-1-neg0.1%
distribute-neg-frac0.1%
mul-1-neg0.1%
remove-double-neg0.1%
Simplified0.1%
Taylor expanded in n around inf 74.6%
associate-/r*74.6%
reciprocal-define74.6%
Simplified74.6%
reciprocal-undefine74.6%
associate-/r*74.6%
reciprocal-define74.6%
*-commutative74.6%
Applied egg-rr74.6%
Final simplification64.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (/ 1.0 x) n)) (t_1 (- 1.0 (pow x (reciprocal n)))))
(if (<= (/ 1.0 n) -5000.0)
t_1
(if (<= (/ 1.0 n) -2e-134)
(/ (- x (log x)) n)
(if (<= (/ 1.0 n) -5e-251)
t_0
(if (<= (/ 1.0 n) 2e-69)
(- (/ (log x) n))
(if (<= (/ 1.0 n) 5e-21)
t_0
(if (<= (/ 1.0 n) 5e+193) t_1 (reciprocal (* n x))))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{1}{x}}{n}\\
t_1 := 1 - {x}^{\mathsf{reciprocal}\left(n\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-134}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-251}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-69}:\\
\;\;\;\;-\frac{\log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-21}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+193}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{reciprocal}\left(\left(n \cdot x\right)\right)\\
\end{array}
\end{array}
if (/.f64 1 n) < -5e3 or 4.99999999999999973e-21 < (/.f64 1 n) < 4.99999999999999972e193Initial program 92.1%
reciprocal-define92.1%
reciprocal-define90.6%
Simplified90.6%
Taylor expanded in x around 0 59.8%
if -5e3 < (/.f64 1 n) < -2.00000000000000008e-134Initial program 14.3%
reciprocal-define14.3%
reciprocal-define14.3%
Simplified14.3%
Taylor expanded in n around inf 73.6%
+-rgt-identity73.6%
+-rgt-identity73.6%
log1p-def73.7%
Simplified73.7%
Taylor expanded in x around 0 59.7%
neg-mul-159.7%
sub-neg59.7%
Simplified59.7%
if -2.00000000000000008e-134 < (/.f64 1 n) < -5.0000000000000003e-251 or 1.9999999999999999e-69 < (/.f64 1 n) < 4.99999999999999973e-21Initial program 38.7%
reciprocal-define38.7%
reciprocal-define38.7%
Simplified38.7%
Taylor expanded in n around inf 65.8%
+-rgt-identity65.8%
+-rgt-identity65.8%
log1p-def65.9%
Simplified65.9%
Taylor expanded in x around inf 73.1%
if -5.0000000000000003e-251 < (/.f64 1 n) < 1.9999999999999999e-69Initial program 30.3%
reciprocal-define30.3%
reciprocal-define30.3%
Simplified30.3%
Taylor expanded in x around 0 30.3%
Taylor expanded in n around inf 64.7%
neg-mul-164.7%
distribute-neg-frac64.7%
Simplified64.7%
if 4.99999999999999972e193 < (/.f64 1 n) Initial program 17.1%
reciprocal-define17.1%
reciprocal-define17.1%
Simplified17.1%
Taylor expanded in x around inf 0.1%
mul-1-neg0.1%
log-rec0.1%
mul-1-neg0.1%
distribute-neg-frac0.1%
mul-1-neg0.1%
remove-double-neg0.1%
Simplified0.1%
Taylor expanded in n around inf 74.6%
associate-/r*74.6%
reciprocal-define74.6%
Simplified74.6%
reciprocal-undefine74.6%
associate-/r*74.6%
reciprocal-define74.6%
*-commutative74.6%
Applied egg-rr74.6%
Final simplification64.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (reciprocal n))))
(if (<= (/ 1.0 n) -2e-16)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-69)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 5e-21)
(pow (* n (+ x 0.5)) -1.0)
(if (<= (/ 1.0 n) 4e+149)
(- 1.0 (pow x (/ 1.0 n)))
(/ (reciprocal t_0) (* n x))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\mathsf{reciprocal}\left(n\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-16}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-69}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-21}:\\
\;\;\;\;{\left(n \cdot \left(x + 0.5\right)\right)}^{-1}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+149}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{reciprocal}\left(t_0\right)}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -2e-16Initial program 94.6%
reciprocal-define94.6%
reciprocal-define94.6%
Simplified94.6%
Taylor expanded in x around inf 99.9%
mul-1-neg99.9%
log-rec99.9%
mul-1-neg99.9%
distribute-neg-frac99.9%
mul-1-neg99.9%
remove-double-neg99.9%
Simplified99.9%
*-un-lft-identity99.9%
times-frac100.0%
remove-double-neg100.0%
distribute-frac-neg100.0%
reciprocal-undefine96.6%
distribute-frac-neg96.6%
remove-double-neg96.6%
div-inv96.6%
reciprocal-undefine96.7%
pow-to-exp96.7%
Applied egg-rr96.7%
reciprocal-define99.0%
times-frac99.0%
*-lft-identity99.0%
*-commutative99.0%
Simplified99.0%
if -2e-16 < (/.f64 1 n) < 1.9999999999999999e-69Initial program 33.5%
reciprocal-define33.5%
reciprocal-define33.5%
Simplified33.5%
Taylor expanded in n around inf 86.1%
+-rgt-identity86.1%
+-rgt-identity86.1%
log1p-def86.1%
Simplified86.1%
log1p-udef86.1%
diff-log86.1%
+-commutative86.1%
Applied egg-rr86.1%
if 1.9999999999999999e-69 < (/.f64 1 n) < 4.99999999999999973e-21Initial program 6.4%
reciprocal-define6.4%
reciprocal-define6.4%
Simplified6.4%
Taylor expanded in n around inf 25.6%
+-rgt-identity25.6%
+-rgt-identity25.6%
log1p-def25.6%
Simplified25.6%
clear-num25.5%
inv-pow25.5%
Applied egg-rr25.5%
Taylor expanded in x around inf 82.5%
*-commutative82.5%
distribute-lft-out82.5%
Simplified82.5%
if 4.99999999999999973e-21 < (/.f64 1 n) < 4.0000000000000002e149Initial program 77.5%
reciprocal-define77.3%
reciprocal-define72.5%
Simplified72.5%
Taylor expanded in x around 0 69.2%
Taylor expanded in n around 0 74.2%
if 4.0000000000000002e149 < (/.f64 1 n) Initial program 25.5%
reciprocal-define25.5%
reciprocal-define25.5%
Simplified25.5%
Taylor expanded in x around inf 0.3%
mul-1-neg0.3%
log-rec0.3%
mul-1-neg0.3%
distribute-neg-frac0.3%
mul-1-neg0.3%
remove-double-neg0.3%
Simplified0.3%
add-sqr-sqrt0.0%
sqrt-unprod78.5%
sqr-neg78.5%
distribute-frac-neg78.5%
distribute-frac-neg78.5%
sqrt-unprod78.5%
add-sqr-sqrt78.5%
distribute-frac-neg78.5%
exp-neg78.5%
div-inv78.5%
reciprocal-undefine78.5%
pow-to-exp78.5%
Applied egg-rr78.5%
reciprocal-define78.5%
Simplified78.5%
Final simplification87.5%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -2e-16)
(/ (pow x (/ 2.0 (* n 2.0))) (* n x))
(if (<= (/ 1.0 n) 2e-69)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 5e-21)
(pow (* n (+ x 0.5)) -1.0)
(if (<= (/ 1.0 n) 4e+149)
(- 1.0 (pow x (/ 1.0 n)))
(/ (reciprocal (pow x (reciprocal n))) (* n x)))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-16}:\\
\;\;\;\;\frac{{x}^{\left(\frac{2}{n \cdot 2}\right)}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-69}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-21}:\\
\;\;\;\;{\left(n \cdot \left(x + 0.5\right)\right)}^{-1}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+149}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{reciprocal}\left(\left({x}^{\mathsf{reciprocal}\left(n\right)}\right)\right)}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -2e-16Initial program 94.6%
reciprocal-define94.6%
reciprocal-define94.6%
Simplified94.6%
Taylor expanded in x around inf 99.9%
mul-1-neg99.9%
log-rec99.9%
mul-1-neg99.9%
distribute-neg-frac99.9%
mul-1-neg99.9%
remove-double-neg99.9%
Simplified99.9%
expm1-log1p-u100.0%
expm1-udef100.0%
log1p-udef99.9%
add-exp-log99.9%
div-inv99.9%
reciprocal-undefine99.0%
pow-to-exp99.0%
Applied egg-rr99.0%
add-exp-log99.0%
log1p-udef99.0%
expm1-udef99.0%
expm1-log1p-u99.0%
sqr-pow99.0%
pow-prod-up99.0%
reciprocal-undefine99.0%
associate-/l/99.0%
reciprocal-define99.0%
reciprocal-undefine99.0%
associate-/l/99.0%
reciprocal-define99.0%
Applied egg-rr99.0%
count-299.0%
reciprocal-undefine99.9%
associate-*r/99.9%
metadata-eval99.9%
*-commutative99.9%
Simplified99.9%
if -2e-16 < (/.f64 1 n) < 1.9999999999999999e-69Initial program 33.5%
reciprocal-define33.5%
reciprocal-define33.5%
Simplified33.5%
Taylor expanded in n around inf 86.1%
+-rgt-identity86.1%
+-rgt-identity86.1%
log1p-def86.1%
Simplified86.1%
log1p-udef86.1%
diff-log86.1%
+-commutative86.1%
Applied egg-rr86.1%
if 1.9999999999999999e-69 < (/.f64 1 n) < 4.99999999999999973e-21Initial program 6.4%
reciprocal-define6.4%
reciprocal-define6.4%
Simplified6.4%
Taylor expanded in n around inf 25.6%
+-rgt-identity25.6%
+-rgt-identity25.6%
log1p-def25.6%
Simplified25.6%
clear-num25.5%
inv-pow25.5%
Applied egg-rr25.5%
Taylor expanded in x around inf 82.5%
*-commutative82.5%
distribute-lft-out82.5%
Simplified82.5%
if 4.99999999999999973e-21 < (/.f64 1 n) < 4.0000000000000002e149Initial program 77.5%
reciprocal-define77.3%
reciprocal-define72.5%
Simplified72.5%
Taylor expanded in x around 0 69.2%
Taylor expanded in n around 0 74.2%
if 4.0000000000000002e149 < (/.f64 1 n) Initial program 25.5%
reciprocal-define25.5%
reciprocal-define25.5%
Simplified25.5%
Taylor expanded in x around inf 0.3%
mul-1-neg0.3%
log-rec0.3%
mul-1-neg0.3%
distribute-neg-frac0.3%
mul-1-neg0.3%
remove-double-neg0.3%
Simplified0.3%
add-sqr-sqrt0.0%
sqrt-unprod78.5%
sqr-neg78.5%
distribute-frac-neg78.5%
distribute-frac-neg78.5%
sqrt-unprod78.5%
add-sqr-sqrt78.5%
distribute-frac-neg78.5%
exp-neg78.5%
div-inv78.5%
reciprocal-undefine78.5%
pow-to-exp78.5%
Applied egg-rr78.5%
reciprocal-define78.5%
Simplified78.5%
Final simplification87.8%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -2e-16)
(/ (pow x (reciprocal n)) (* n x))
(if (<= (/ 1.0 n) 2e-69)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 5e-21)
(pow (* n (+ x 0.5)) -1.0)
(if (<= (/ 1.0 n) 5e+193)
(- 1.0 (pow x (/ 1.0 n)))
(reciprocal (* n x)))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-16}:\\
\;\;\;\;\frac{{x}^{\mathsf{reciprocal}\left(n\right)}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-69}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-21}:\\
\;\;\;\;{\left(n \cdot \left(x + 0.5\right)\right)}^{-1}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+193}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{reciprocal}\left(\left(n \cdot x\right)\right)\\
\end{array}
\end{array}
if (/.f64 1 n) < -2e-16Initial program 94.6%
reciprocal-define94.6%
reciprocal-define94.6%
Simplified94.6%
Taylor expanded in x around inf 99.9%
mul-1-neg99.9%
log-rec99.9%
mul-1-neg99.9%
distribute-neg-frac99.9%
mul-1-neg99.9%
remove-double-neg99.9%
Simplified99.9%
*-un-lft-identity99.9%
times-frac100.0%
remove-double-neg100.0%
distribute-frac-neg100.0%
reciprocal-undefine96.6%
distribute-frac-neg96.6%
remove-double-neg96.6%
div-inv96.6%
reciprocal-undefine96.7%
pow-to-exp96.7%
Applied egg-rr96.7%
reciprocal-define99.0%
times-frac99.0%
*-lft-identity99.0%
*-commutative99.0%
Simplified99.0%
if -2e-16 < (/.f64 1 n) < 1.9999999999999999e-69Initial program 33.5%
reciprocal-define33.5%
reciprocal-define33.5%
Simplified33.5%
Taylor expanded in n around inf 86.1%
+-rgt-identity86.1%
+-rgt-identity86.1%
log1p-def86.1%
Simplified86.1%
log1p-udef86.1%
diff-log86.1%
+-commutative86.1%
Applied egg-rr86.1%
if 1.9999999999999999e-69 < (/.f64 1 n) < 4.99999999999999973e-21Initial program 6.4%
reciprocal-define6.4%
reciprocal-define6.4%
Simplified6.4%
Taylor expanded in n around inf 25.6%
+-rgt-identity25.6%
+-rgt-identity25.6%
log1p-def25.6%
Simplified25.6%
clear-num25.5%
inv-pow25.5%
Applied egg-rr25.5%
Taylor expanded in x around inf 82.5%
*-commutative82.5%
distribute-lft-out82.5%
Simplified82.5%
if 4.99999999999999973e-21 < (/.f64 1 n) < 4.99999999999999972e193Initial program 76.7%
reciprocal-define76.5%
reciprocal-define72.1%
Simplified72.1%
Taylor expanded in x around 0 66.2%
Taylor expanded in n around 0 70.8%
if 4.99999999999999972e193 < (/.f64 1 n) Initial program 17.1%
reciprocal-define17.1%
reciprocal-define17.1%
Simplified17.1%
Taylor expanded in x around inf 0.1%
mul-1-neg0.1%
log-rec0.1%
mul-1-neg0.1%
distribute-neg-frac0.1%
mul-1-neg0.1%
remove-double-neg0.1%
Simplified0.1%
Taylor expanded in n around inf 74.6%
associate-/r*74.6%
reciprocal-define74.6%
Simplified74.6%
reciprocal-undefine74.6%
associate-/r*74.6%
reciprocal-define74.6%
*-commutative74.6%
Applied egg-rr74.6%
Final simplification86.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log (reciprocal x)) n)))
(if (<= x 3.5e-221)
t_0
(if (<= x 1.36e-145)
(reciprocal (* n x))
(if (<= x 0.55) t_0 (/ (/ 1.0 x) n))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log \mathsf{reciprocal}\left(x\right)}{n}\\
\mathbf{if}\;x \leq 3.5 \cdot 10^{-221}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.36 \cdot 10^{-145}:\\
\;\;\;\;\mathsf{reciprocal}\left(\left(n \cdot x\right)\right)\\
\mathbf{elif}\;x \leq 0.55:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if x < 3.4999999999999999e-221 or 1.36e-145 < x < 0.55000000000000004Initial program 44.4%
reciprocal-define44.4%
reciprocal-define43.4%
Simplified43.4%
Taylor expanded in n around inf 52.9%
+-rgt-identity52.9%
+-rgt-identity52.9%
log1p-def52.9%
Simplified52.9%
clear-num52.9%
inv-pow52.9%
Applied egg-rr52.9%
Taylor expanded in x around 0 50.5%
associate-*r/50.5%
neg-mul-150.5%
log-rec50.5%
reciprocal-define28.8%
Simplified28.8%
if 3.4999999999999999e-221 < x < 1.36e-145Initial program 44.9%
reciprocal-define44.9%
reciprocal-define44.0%
Simplified44.0%
Taylor expanded in x around inf 27.2%
mul-1-neg27.2%
log-rec27.2%
mul-1-neg27.2%
distribute-neg-frac27.2%
mul-1-neg27.2%
remove-double-neg27.2%
Simplified27.2%
Taylor expanded in n around inf 38.4%
associate-/r*38.4%
reciprocal-define38.4%
Simplified38.4%
reciprocal-undefine38.4%
associate-/r*38.4%
reciprocal-define38.4%
*-commutative38.4%
Applied egg-rr38.4%
if 0.55000000000000004 < x Initial program 69.2%
reciprocal-define69.1%
reciprocal-define69.2%
Simplified69.2%
Taylor expanded in n around inf 66.7%
+-rgt-identity66.7%
+-rgt-identity66.7%
log1p-def66.7%
Simplified66.7%
Taylor expanded in x around inf 67.5%
Final simplification45.7%
(FPCore (x n) :precision binary64 (if (<= x 0.55) (- (/ (log x) n)) (/ (/ 1.0 x) n)))
double code(double x, double n) {
double tmp;
if (x <= 0.55) {
tmp = -(log(x) / n);
} else {
tmp = (1.0 / 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 <= 0.55d0) then
tmp = -(log(x) / n)
else
tmp = (1.0d0 / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.55) {
tmp = -(Math.log(x) / n);
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.55: tmp = -(math.log(x) / n) else: tmp = (1.0 / x) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 0.55) tmp = Float64(-Float64(log(x) / n)); else tmp = Float64(Float64(1.0 / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.55) tmp = -(log(x) / n); else tmp = (1.0 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.55], (-N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.55:\\
\;\;\;\;-\frac{\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if x < 0.55000000000000004Initial program 44.6%
reciprocal-define44.6%
reciprocal-define43.6%
Simplified43.6%
Taylor expanded in x around 0 41.7%
Taylor expanded in n around inf 47.8%
neg-mul-147.8%
distribute-neg-frac47.8%
Simplified47.8%
if 0.55000000000000004 < x Initial program 69.2%
reciprocal-define69.1%
reciprocal-define69.2%
Simplified69.2%
Taylor expanded in n around inf 66.7%
+-rgt-identity66.7%
+-rgt-identity66.7%
log1p-def66.7%
Simplified66.7%
Taylor expanded in x around inf 67.5%
Final simplification55.5%
(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 54.2%
reciprocal-define54.1%
reciprocal-define53.6%
Simplified53.6%
Taylor expanded in x around inf 54.4%
mul-1-neg54.4%
log-rec54.4%
mul-1-neg54.4%
distribute-neg-frac54.4%
mul-1-neg54.4%
remove-double-neg54.4%
Simplified54.4%
Taylor expanded in n around inf 38.5%
Final simplification38.5%
(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 54.2%
reciprocal-define54.1%
reciprocal-define53.6%
Simplified53.6%
Taylor expanded in x around inf 54.4%
mul-1-neg54.4%
log-rec54.4%
mul-1-neg54.4%
distribute-neg-frac54.4%
mul-1-neg54.4%
remove-double-neg54.4%
Simplified54.4%
Taylor expanded in n around inf 38.5%
associate-/r*39.2%
reciprocal-define32.7%
Simplified32.7%
Taylor expanded in n around 0 39.2%
Final simplification39.2%
(FPCore (x n) :precision binary64 (/ (/ 1.0 x) n))
double code(double x, double n) {
return (1.0 / x) / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 / x) / n
end function
public static double code(double x, double n) {
return (1.0 / x) / n;
}
def code(x, n): return (1.0 / x) / n
function code(x, n) return Float64(Float64(1.0 / x) / n) end
function tmp = code(x, n) tmp = (1.0 / x) / n; end
code[x_, n_] := N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{n}
\end{array}
Initial program 54.2%
reciprocal-define54.1%
reciprocal-define53.6%
Simplified53.6%
Taylor expanded in n around inf 56.2%
+-rgt-identity56.2%
+-rgt-identity56.2%
log1p-def56.2%
Simplified56.2%
Taylor expanded in x around inf 39.2%
Final simplification39.2%
(FPCore (x n) :precision binary64 (reciprocal (* n x)))
\begin{array}{l}
\\
\mathsf{reciprocal}\left(\left(n \cdot x\right)\right)
\end{array}
Initial program 54.2%
reciprocal-define54.1%
reciprocal-define53.6%
Simplified53.6%
Taylor expanded in x around inf 54.4%
mul-1-neg54.4%
log-rec54.4%
mul-1-neg54.4%
distribute-neg-frac54.4%
mul-1-neg54.4%
remove-double-neg54.4%
Simplified54.4%
Taylor expanded in n around inf 38.5%
associate-/r*39.2%
reciprocal-define32.7%
Simplified32.7%
reciprocal-undefine39.2%
associate-/r*38.5%
reciprocal-define32.3%
*-commutative32.3%
Applied egg-rr32.3%
Final simplification32.3%
(FPCore (x n) :precision binary64 (/ (reciprocal n) x))
\begin{array}{l}
\\
\frac{\mathsf{reciprocal}\left(n\right)}{x}
\end{array}
Initial program 54.2%
reciprocal-define54.1%
reciprocal-define53.6%
Simplified53.6%
Taylor expanded in x around inf 54.4%
mul-1-neg54.4%
log-rec54.4%
mul-1-neg54.4%
distribute-neg-frac54.4%
mul-1-neg54.4%
remove-double-neg54.4%
Simplified54.4%
Taylor expanded in n around inf 38.5%
associate-/r*39.2%
reciprocal-define32.7%
Simplified32.7%
Final simplification32.7%
(FPCore (x n) :precision binary64 (/ (reciprocal x) n))
\begin{array}{l}
\\
\frac{\mathsf{reciprocal}\left(x\right)}{n}
\end{array}
Initial program 54.2%
reciprocal-define54.1%
reciprocal-define53.6%
Simplified53.6%
Taylor expanded in n around inf 56.2%
+-rgt-identity56.2%
+-rgt-identity56.2%
log1p-def56.2%
Simplified56.2%
Taylor expanded in x around inf 39.2%
reciprocal-define32.7%
Simplified32.7%
Final simplification32.7%
(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 54.2%
reciprocal-define54.1%
reciprocal-define53.6%
Simplified53.6%
Taylor expanded in x around inf 54.4%
mul-1-neg54.4%
log-rec54.4%
mul-1-neg54.4%
distribute-neg-frac54.4%
mul-1-neg54.4%
remove-double-neg54.4%
Simplified54.4%
Taylor expanded in n around inf 38.5%
associate-/r*39.2%
reciprocal-define32.7%
Simplified32.7%
reciprocal-undefine39.2%
associate-/r*38.5%
reciprocal-define32.3%
*-commutative32.3%
Applied egg-rr32.3%
expm1-log1p-u25.3%
expm1-udef24.5%
reciprocal-undefine24.5%
associate-/r*24.5%
add-exp-log24.5%
neg-log24.5%
add-sqr-sqrt6.1%
sqrt-unprod13.2%
sqr-neg13.2%
sqrt-unprod7.1%
add-sqr-sqrt9.5%
add-exp-log9.5%
Applied egg-rr9.5%
expm1-def3.8%
expm1-log1p4.5%
Simplified4.5%
Final simplification4.5%
herbie shell --seed 2024024
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))