| Alternative 1 | |
|---|---|
| Error | 0.0 |
| Cost | 13056 |
\[\frac{\mathsf{log1p}\left(-x\right)}{\mathsf{log1p}\left(x\right)}
\]
(FPCore (x) :precision binary64 (/ (log (- 1.0 x)) (log (+ 1.0 x))))
(FPCore (x) :precision binary64 (let* ((t_0 (log1p (- x)))) (if (!= t_0 0.0) (/ (/ 1.0 (log1p x)) (/ 1.0 t_0)) (/ t_0 (log1p x)))))
double code(double x) {
return log((1.0 - x)) / log((1.0 + x));
}
double code(double x) {
double t_0 = log1p(-x);
double tmp;
if (t_0 != 0.0) {
tmp = (1.0 / log1p(x)) / (1.0 / t_0);
} else {
tmp = t_0 / log1p(x);
}
return tmp;
}
public static double code(double x) {
return Math.log((1.0 - x)) / Math.log((1.0 + x));
}
public static double code(double x) {
double t_0 = Math.log1p(-x);
double tmp;
if (t_0 != 0.0) {
tmp = (1.0 / Math.log1p(x)) / (1.0 / t_0);
} else {
tmp = t_0 / Math.log1p(x);
}
return tmp;
}
def code(x): return math.log((1.0 - x)) / math.log((1.0 + x))
def code(x): t_0 = math.log1p(-x) tmp = 0 if t_0 != 0.0: tmp = (1.0 / math.log1p(x)) / (1.0 / t_0) else: tmp = t_0 / math.log1p(x) return tmp
function code(x) return Float64(log(Float64(1.0 - x)) / log(Float64(1.0 + x))) end
function code(x) t_0 = log1p(Float64(-x)) tmp = 0.0 if (t_0 != 0.0) tmp = Float64(Float64(1.0 / log1p(x)) / Float64(1.0 / t_0)); else tmp = Float64(t_0 / log1p(x)); end return tmp end
code[x_] := N[(N[Log[N[(1.0 - x), $MachinePrecision]], $MachinePrecision] / N[Log[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x_] := Block[{t$95$0 = N[Log[1 + (-x)], $MachinePrecision]}, If[Unequal[t$95$0, 0.0], N[(N[(1.0 / N[Log[1 + x], $MachinePrecision]), $MachinePrecision] / N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[Log[1 + x], $MachinePrecision]), $MachinePrecision]]]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\begin{array}{l}
t_0 := \mathsf{log1p}\left(-x\right)\\
\mathbf{if}\;t_0 \ne 0:\\
\;\;\;\;\frac{\frac{1}{\mathsf{log1p}\left(x\right)}}{\frac{1}{t_0}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{\mathsf{log1p}\left(x\right)}\\
\end{array}
| Original | 61.5 |
|---|---|
| Target | 0.3 |
| Herbie | 0.0 |
Initial program 61.5
Applied egg-rr0.2
Applied egg-rr0.0
| Alternative 1 | |
|---|---|
| Error | 0.0 |
| Cost | 13056 |
| Alternative 2 | |
|---|---|
| Error | 0.3 |
| Cost | 3140 |
| Alternative 3 | |
|---|---|
| Error | 0.3 |
| Cost | 3140 |
| Alternative 4 | |
|---|---|
| Error | 0.3 |
| Cost | 1152 |
| Alternative 5 | |
|---|---|
| Error | 0.3 |
| Cost | 832 |
| Alternative 6 | |
|---|---|
| Error | 0.4 |
| Cost | 576 |
| Alternative 7 | |
|---|---|
| Error | 0.4 |
| Cost | 576 |
| Alternative 8 | |
|---|---|
| Error | 0.6 |
| Cost | 192 |
| Alternative 9 | |
|---|---|
| Error | 1.2 |
| Cost | 64 |
herbie shell --seed 2023010
(FPCore (x)
:name "qlog (example 3.10)"
:precision binary64
:pre (and (< -1.0 x) (< x 1.0))
:herbie-target
(- (+ (+ (+ 1.0 x) (/ (* x x) 2.0)) (* 0.4166666666666667 (pow x 3.0))))
(/ (log (- 1.0 x)) (log (+ 1.0 x))))