| Alternative 1 | |
|---|---|
| Error | 32.3 |
| Cost | 19712 |
\[e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}
\]
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
(FPCore (x n) :precision binary64 (log (exp (- (exp (/ (log1p x) 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));
}
double code(double x, double n) {
return log(exp((exp((log1p(x) / n)) - pow(x, (1.0 / n)))));
}
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
public static double code(double x, double n) {
return Math.log(Math.exp((Math.exp((Math.log1p(x) / 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))
def code(x, n): return math.log(math.exp((math.exp((math.log1p(x) / 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 code(x, n) return log(exp(Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(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]
code[x_, n_] := N[Log[N[Exp[N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\log \left(e^{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}}\right)
Results
Initial program 32.6
Applied egg-rr32.5
Final simplification32.5
| Alternative 1 | |
|---|---|
| Error | 32.3 |
| Cost | 19712 |
| Alternative 2 | |
|---|---|
| Error | 32.7 |
| Cost | 13760 |
| Alternative 3 | |
|---|---|
| Error | 44.9 |
| Cost | 13504 |
| Alternative 4 | |
|---|---|
| Error | 32.6 |
| Cost | 13504 |
herbie shell --seed 2022334
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))