| Alternative 1 | |
|---|---|
| Error | 29.8 |
| Cost | 19392 |
\[\log \left(e^{a} + e^{b}\right)
\]
(FPCore (a b) :precision binary64 (log (+ (exp a) (exp b))))
(FPCore (a b) :precision binary64 (log1p (+ (exp a) (expm1 b))))
double code(double a, double b) {
return log((exp(a) + exp(b)));
}
double code(double a, double b) {
return log1p((exp(a) + expm1(b)));
}
public static double code(double a, double b) {
return Math.log((Math.exp(a) + Math.exp(b)));
}
public static double code(double a, double b) {
return Math.log1p((Math.exp(a) + Math.expm1(b)));
}
def code(a, b): return math.log((math.exp(a) + math.exp(b)))
def code(a, b): return math.log1p((math.exp(a) + math.expm1(b)))
function code(a, b) return log(Float64(exp(a) + exp(b))) end
function code(a, b) return log1p(Float64(exp(a) + expm1(b))) end
code[a_, b_] := N[Log[N[(N[Exp[a], $MachinePrecision] + N[Exp[b], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[a_, b_] := N[Log[1 + N[(N[Exp[a], $MachinePrecision] + N[(Exp[b] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\log \left(e^{a} + e^{b}\right)
\mathsf{log1p}\left(e^{a} + \mathsf{expm1}\left(b\right)\right)
Results
Initial program 29.8
Applied egg-rr30.0
Applied egg-rr29.9
Simplified1.3
Final simplification1.3
| Alternative 1 | |
|---|---|
| Error | 29.8 |
| Cost | 19392 |
herbie shell --seed 2022334
(FPCore (a b)
:name "symmetry log of sum of exp"
:precision binary64
(log (+ (exp a) (exp b))))