Alternative 1 | |
---|---|
Error | 1.3 |
Cost | 13120 |
\[\log \left(x \cdot 0.5 + \log 2\right)
\]
(FPCore (x) :precision binary64 (log (log (+ 1.0 (exp x)))))
(FPCore (x) :precision binary64 (log (log1p (exp x))))
double code(double x) { return log(log((1.0 + exp(x)))); }
double code(double x) { return log(log1p(exp(x))); }
public static double code(double x) { return Math.log(Math.log((1.0 + Math.exp(x)))); }
public static double code(double x) { return Math.log(Math.log1p(Math.exp(x))); }
def code(x): return math.log(math.log((1.0 + math.exp(x))))
def code(x): return math.log(math.log1p(math.exp(x)))
function code(x) return log(log(Float64(1.0 + exp(x)))) end
function code(x) return log(log1p(exp(x))) end
code[x_] := N[Log[N[Log[N[(1.0 + N[Exp[x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
code[x_] := N[Log[N[Log[1 + N[Exp[x], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\log \log \left(1 + e^{x}\right)
\log \left(\mathsf{log1p}\left(e^{x}\right)\right)
Results
Initial program 0.4
Simplified0.1
[Start]0.4 | \[ \log \log \left(1 + e^{x}\right)
\] |
---|---|
log1p-def [=>]0.1 | \[ \log \color{blue}{\left(\mathsf{log1p}\left(e^{x}\right)\right)}
\] |
Final simplification0.1
Alternative 1 | |
---|---|
Error | 1.3 |
Cost | 13120 |
Alternative 2 | |
---|---|
Error | 1.4 |
Cost | 12992 |
Alternative 3 | |
---|---|
Error | 2.0 |
Cost | 12864 |
Alternative 4 | |
---|---|
Error | 64.0 |
Cost | 6592 |
herbie shell --seed 1
(FPCore (x)
:name "log(log(1+exp(x)))"
:precision binary64
:pre (and (<= -1000.0 x) (<= x 0.0))
(log (log (+ 1.0 (exp x)))))