| Alternative 1 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 13056 |
\[-\log \left(\frac{\log x}{x}\right)
\]

(FPCore (x) :precision binary64 (- (log x) (log (log x))))
(FPCore (x) :precision binary64 (- (log (/ (log x) x))))
double code(double x) {
return log(x) - log(log(x));
}
double code(double x) {
return -log((log(x) / x));
}
real(8) function code(x)
real(8), intent (in) :: x
code = log(x) - log(log(x))
end function
real(8) function code(x)
real(8), intent (in) :: x
code = -log((log(x) / x))
end function
public static double code(double x) {
return Math.log(x) - Math.log(Math.log(x));
}
public static double code(double x) {
return -Math.log((Math.log(x) / x));
}
def code(x): return math.log(x) - math.log(math.log(x))
def code(x): return -math.log((math.log(x) / x))
function code(x) return Float64(log(x) - log(log(x))) end
function code(x) return Float64(-log(Float64(log(x) / x))) end
function tmp = code(x) tmp = log(x) - log(log(x)); end
function tmp = code(x) tmp = -log((log(x) / x)); end
code[x_] := N[(N[Log[x], $MachinePrecision] - N[Log[N[Log[x], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x_] := (-N[Log[N[(N[Log[x], $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision])
\log x - \log \log x
-\log \left(\frac{\log x}{x}\right)
Herbie found 3 alternatives:
| Alternative | Accuracy | Speedup |
|---|
Results
Initial program 99.6%
Applied egg-rr98.3%
[Start]99.6% | \[ \log x - \log \log x
\] |
|---|---|
expm1-log1p-u [=>]98.2% | \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\log x - \log \log x\right)\right)}
\] |
diff-log [=>]98.3% | \[ \mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\log \left(\frac{x}{\log x}\right)}\right)\right)
\] |
Applied egg-rr100.0%
[Start]98.3% | \[ \mathsf{expm1}\left(\mathsf{log1p}\left(\log \left(\frac{x}{\log x}\right)\right)\right)
\] |
|---|---|
expm1-log1p-u [<=]100.0% | \[ \color{blue}{\log \left(\frac{x}{\log x}\right)}
\] |
clear-num [=>]100.0% | \[ \log \color{blue}{\left(\frac{1}{\frac{\log x}{x}}\right)}
\] |
log-rec [=>]100.0% | \[ \color{blue}{-\log \left(\frac{\log x}{x}\right)}
\] |
Final simplification100.0%
| Alternative 1 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 13056 |
| Alternative 2 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 12992 |
| Alternative 3 | |
|---|---|
| Accuracy | 0.6% |
| Cost | 6464 |
herbie shell --seed 2023272
(FPCore (x)
:name "Jmat.Real.lambertw, estimator"
:precision binary64
(- (log x) (log (log x))))