\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}-1 - \left(x + \left(x \cdot x\right) \cdot 0.5\right)
(FPCore (x) :precision binary64 (/ (log (- 1.0 x)) (log (+ 1.0 x))))
(FPCore (x) :precision binary64 (- -1.0 (+ x (* (* x x) 0.5))))
double code(double x) {
return log(1.0 - x) / log(1.0 + x);
}
double code(double x) {
return -1.0 - (x + ((x * x) * 0.5));
}






















Bits error versus x
Results
| Original | 61.4 |
|---|---|
| Target | 0.4 |
| Herbie | 0.5 |
| Alternative 1 | |
|---|---|
| Error | 61.4 |
| Cost | 45888 |
| Alternative 2 | |
|---|---|
| Error | 61.4 |
| Cost | 45760 |
| Alternative 3 | |
|---|---|
| Error | 61.7 |
| Cost | 32704 |
| Alternative 4 | |
|---|---|
| Error | 61.6 |
| Cost | 32704 |
| Alternative 5 | |
|---|---|
| Error | 61.3 |
| Cost | 26624 |
| Alternative 6 | |
|---|---|
| Error | 61.3 |
| Cost | 26624 |
| Alternative 7 | |
|---|---|
| Error | 61.4 |
| Cost | 26112 |
| Alternative 8 | |
|---|---|
| Error | 61.3 |
| Cost | 20032 |
| Alternative 9 | |
|---|---|
| Error | 61.3 |
| Cost | 20032 |
| Alternative 10 | |
|---|---|
| Error | 61.3 |
| Cost | 13504 |
| Alternative 11 | |
|---|---|
| Error | 61.4 |
| Cost | 13248 |
| Alternative 12 | |
|---|---|
| Error | 62.5 |
| Cost | 7104 |
| Alternative 13 | |
|---|---|
| Error | 62.7 |
| Cost | 6784 |
| Alternative 14 | |
|---|---|
| Error | 60.8 |
| Cost | 6720 |
| Alternative 15 | |
|---|---|
| Error | 0.7 |
| Cost | 192 |
| Alternative 16 | |
|---|---|
| Error | 1.3 |
| Cost | 64 |
| Alternative 17 | |
|---|---|
| Error | 63.0 |
| Cost | 64 |
| Alternative 18 | |
|---|---|
| Error | 62.0 |
| Cost | 64 |

Initial program 61.4
Taylor expanded around 0 0.5
Simplified0.5
Simplified0.5
Final simplification0.5
herbie shell --seed 2021042
(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))))