Average Error: 61.0 → 0.5
Time: 18.9s
Precision: 64
Internal Precision: 128
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[-1 - \left(x + \left(\frac{1}{2} \cdot x\right) \cdot x\right)\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original61.0
Target0.4
Herbie0.5
\[-\left(\left(\left(1 + x\right) + \frac{x \cdot x}{2}\right) + \frac{5}{12} \cdot {x}^{3}\right)\]

Derivation

  1. Initial program 61.0

    \[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
  2. Taylor expanded around 0 0.5

    \[\leadsto \color{blue}{-\left(x + \left(\frac{1}{2} \cdot {x}^{2} + 1\right)\right)}\]
  3. Simplified0.5

    \[\leadsto \color{blue}{\left(-1 - x\right) - x \cdot \left(x \cdot \frac{1}{2}\right)}\]
  4. Using strategy rm
  5. Applied associate--l-0.5

    \[\leadsto \color{blue}{-1 - \left(x + x \cdot \left(x \cdot \frac{1}{2}\right)\right)}\]
  6. Final simplification0.5

    \[\leadsto -1 - \left(x + \left(\frac{1}{2} \cdot x\right) \cdot x\right)\]

Reproduce

herbie shell --seed 2018362 
(FPCore (x)
  :name "qlog (example 3.10)"
  :pre (and (< -1 x) (< x 1))

  :herbie-target
  (- (+ (+ (+ 1 x) (/ (* x x) 2)) (* 5/12 (pow x 3))))

  (/ (log (- 1 x)) (log (+ 1 x))))

Details

Time bar (total: 7.3s)Debug log

start213.0ms

Algorithm
intervals

setup36.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 60.6b

localize18.0ms

Local error

Found 3 expressions with local error:

7.9b
(log (- 1 x))
7.8b
(log (+ 1 x))
0.0b
(/ (log (- 1 x)) (log (+ 1 x)))

rewrite14.0ms

Algorithm
rewrite-expression-head
Counts
3 → 66
Calls

3 calls. Slowest were:

9.0ms
(/ (log (- 1 x)) (log (+ 1 x)))
2.0ms
(log (- 1 x))
1.0ms
(log (+ 1 x))

series153.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

76.0ms
(/ (log (- 1 x)) (log (+ 1 x)))
39.0ms
(log (- 1 x))
38.0ms
(log (+ 1 x))

simplify2.0s

Counts
63 → 75
Calls

63 calls. Slowest were:

304.0ms
(- (+ (/ 1 x) (log -1)) (+ (log (/ -1 x)) (* 1/2 (/ 1 (pow x 2)))))
268.0ms
(- (log -1) (+ (log (/ 1 x)) (+ (* 1/2 (/ 1 (pow x 2))) (/ 1 x))))
198.0ms
(- (+ (log (/ -1 x)) (+ (* 1/2 (/ 1 (pow x 2))) (/ 1 x))))

prune695.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.0b

localize10.0ms

Local error

Found 1 expressions with local error:

0.0b
(- (- -1 x) (* x (* x 1/2)))

rewrite4.0ms

Algorithm
rewrite-expression-head
Counts
1 → 15
Calls

1 calls. Slowest were:

4.0ms
(- (- -1 x) (* x (* x 1/2)))

series10.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

10.0ms
(- (- -1 x) (* x (* x 1/2)))

simplify405.0ms

Counts
4 → 18
Calls

4 calls. Slowest were:

167.0ms
(/ (exp (- -1 x)) (exp (* x (* x 1/2))))
84.0ms
(- (+ x (+ (* 1/2 (pow x 2)) 1)))
78.0ms
(- (+ x (+ (* 1/2 (pow x 2)) 1)))

prune142.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.0b

localize9.0ms

Local error

Found 0 expressions with local error:

rewrite0.0ms

Algorithm
rewrite-expression-head
Counts
0 → 0
Calls

0 calls. Slowest were:

series0.0ms

Counts
0 → 0
Calls

0 calls. Slowest were:

simplify0.0ms

Counts
0 → 0
Calls

0 calls. Slowest were:

prune11.0ms

Pruning

4 alts after pruning (2 fresh and 2 done)

Merged error: 0.0b

localize6.0ms

Local error

Found 3 expressions with local error:

0.0b
(- (- -1 x) (* x (* x 1/2)))
0.0b
(exp (- (- -1 x) (* x (* x 1/2))))
0.0b
(log (exp (- (- -1 x) (* x (* x 1/2)))))

rewrite18.0ms

Algorithm
rewrite-expression-head
Counts
3 → 52
Calls

3 calls. Slowest were:

8.0ms
(exp (- (- -1 x) (* x (* x 1/2))))
6.0ms
(log (exp (- (- -1 x) (* x (* x 1/2)))))
4.0ms
(- (- -1 x) (* x (* x 1/2)))

series49.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

24.0ms
(exp (- (- -1 x) (* x (* x 1/2))))
15.0ms
(log (exp (- (- -1 x) (* x (* x 1/2)))))
9.0ms
(- (- -1 x) (* x (* x 1/2)))

simplify2.8s

Counts
32 → 61
Calls

32 calls. Slowest were:

454.0ms
(- (+ (* 1/3 (* (pow x 3) (exp -1))) (exp -1)) (* x (exp -1)))
283.0ms
(exp (- (+ x (+ (* 1/2 (pow x 2)) 1))))
225.0ms
(log (sqrt (exp (- (- -1 x) (* x (* x 1/2))))))

prune625.0ms

Pruning

4 alts after pruning (1 fresh and 3 done)

Merged error: 0.0b

regimes100.0ms

Accuracy

0% (0.4b remaining)

Error of 0.5b against oracle of 0.1b and baseline of 0.5b

bsearch2.0ms