# ?

Average Error: 0.4 → 0.1
Time: 10.5s
Precision: binary64
Cost: 19264

# ?

$-1000 \leq x \land x \leq 0$
$\log \log \left(1 + e^{x}\right)$
$\log \left(\mathsf{log1p}\left(e^{x}\right)\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)


# Try it out?

Results

 In Out
Enter valid numbers for all inputs

# Derivation?

1. Initial program 0.4

$\log \log \left(1 + e^{x}\right)$
2. Simplified0.1

$\leadsto \color{blue}{\log \left(\mathsf{log1p}\left(e^{x}\right)\right)}$
Proof
[Start]0.4 $\log \log \left(1 + e^{x}\right)$ $\log \color{blue}{\left(\mathsf{log1p}\left(e^{x}\right)\right)}$
3. Final simplification0.1

$\leadsto \log \left(\mathsf{log1p}\left(e^{x}\right)\right)$

# Alternatives

Alternative 1
Error1.3
Cost13120
$\log \left(x \cdot 0.5 + \log 2\right)$
Alternative 2
Error1.4
Cost12992
$\log \log \left(x + 2\right)$
Alternative 3
Error2.0
Cost12864
$\log \log 2$
Alternative 4
Error64.0
Cost6592
$\log \left(x \cdot 0.5\right)$

# Reproduce?

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)))))