Alternative 1 | |
---|---|
Error | 0.0 |
Cost | 19392 |
\[\log \left(e^{y} + e^{x}\right)
\]
(FPCore (x y) :precision binary64 (log (+ (exp x) (exp y))))
(FPCore (x y) :precision binary64 (log1p (+ (exp y) (expm1 x))))
double code(double x, double y) { return log((exp(x) + exp(y))); }
double code(double x, double y) { return log1p((exp(y) + expm1(x))); }
public static double code(double x, double y) { return Math.log((Math.exp(x) + Math.exp(y))); }
public static double code(double x, double y) { return Math.log1p((Math.exp(y) + Math.expm1(x))); }
def code(x, y): return math.log((math.exp(x) + math.exp(y)))
def code(x, y): return math.log1p((math.exp(y) + math.expm1(x)))
function code(x, y) return log(Float64(exp(x) + exp(y))) end
function code(x, y) return log1p(Float64(exp(y) + expm1(x))) end
code[x_, y_] := N[Log[N[(N[Exp[x], $MachinePrecision] + N[Exp[y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[x_, y_] := N[Log[1 + N[(N[Exp[y], $MachinePrecision] + N[(Exp[x] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\log \left(e^{x} + e^{y}\right)
\mathsf{log1p}\left(e^{y} + \mathsf{expm1}\left(x\right)\right)
Results
Initial program 0.0
Taylor expanded in x around inf 0.0
Simplified0.0
[Start]0.0 | \[ \log \left(e^{y} + e^{x}\right)
\] |
---|---|
+-commutative [=>]0.0 | \[ \log \color{blue}{\left(e^{x} + e^{y}\right)}
\] |
log1p-expm1 [<=]0.0 | \[ \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\log \left(e^{x} + e^{y}\right)\right)\right)}
\] |
expm1-def [<=]0.0 | \[ \mathsf{log1p}\left(\color{blue}{e^{\log \left(e^{x} + e^{y}\right)} - 1}\right)
\] |
rem-exp-log [=>]0.0 | \[ \mathsf{log1p}\left(\color{blue}{\left(e^{x} + e^{y}\right)} - 1\right)
\] |
+-commutative [<=]0.0 | \[ \mathsf{log1p}\left(\color{blue}{\left(e^{y} + e^{x}\right)} - 1\right)
\] |
associate--l+ [=>]0.0 | \[ \mathsf{log1p}\left(\color{blue}{e^{y} + \left(e^{x} - 1\right)}\right)
\] |
expm1-def [=>]0.0 | \[ \mathsf{log1p}\left(e^{y} + \color{blue}{\mathsf{expm1}\left(x\right)}\right)
\] |
Final simplification0.0
Alternative 1 | |
---|---|
Error | 0.0 |
Cost | 19392 |
Alternative 2 | |
---|---|
Error | 12.5 |
Cost | 13760 |
Alternative 3 | |
---|---|
Error | 12.5 |
Cost | 12992 |
Alternative 4 | |
---|---|
Error | 12.6 |
Cost | 12864 |
Alternative 5 | |
---|---|
Error | 53.8 |
Cost | 6720 |
Alternative 6 | |
---|---|
Error | 51.9 |
Cost | 6720 |
Alternative 7 | |
---|---|
Error | 53.9 |
Cost | 6592 |
Alternative 8 | |
---|---|
Error | 54.6 |
Cost | 6464 |
Alternative 9 | |
---|---|
Error | 54.4 |
Cost | 6464 |
herbie shell --seed 1
(FPCore (x y)
:name "log(exp(x)+exp(y))"
:precision binary64
:pre (and (and (<= 1.0 x) (<= x 500.0)) (and (<= 1.0 y) (<= y 500.0)))
(log (+ (exp x) (exp y))))