Average Error: 60.8 → 0.5
Time: 17.2s
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

Original60.8
Target0.3
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 60.8

    \[\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 2019021 
(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: 16.8s)Debug log

sample253.0ms

Algorithm
intervals
Results
149.0ms105×body1280valid
62.0ms81×body640valid
18.0ms46×body320valid
8.0ms256×pre80true
4.0ms17×body160valid
1.0msbody80valid

simplify4.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
4.0ms
(/ (log (- 1 x)) (log (+ 1 x)))

prune5.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 60.8b

localize27.0ms

Local error

Found 3 expressions with local error:

6.2b
(log (- 1 x))
6.2b
(log (+ 1 x))
0.0b
(/ (log (- 1 x)) (log (+ 1 x)))

rewrite15.0ms

Algorithm
rewrite-expression-head
Rules
16×times-frac
15×add-cube-cbrt
15×*-un-lft-identity
15×pow1
15×add-sqr-sqrt
12×log-pow
add-exp-log
log-prod
log-div
add-cbrt-cube
associate-/l*
associate-/r*
add-log-exp
flip--
rem-log-exp
div-sub
flip3--
div-inv
flip-+
div-exp
flip3-+
frac-2neg
clear-num
cbrt-undiv
Counts
3 → 66
Calls
3 calls:
Slowest
11.0ms
(/ (log (- 1 x)) (log (+ 1 x)))
2.0ms
(log (- 1 x))
2.0ms
(log (+ 1 x))

series133.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
65.0ms
(/ (log (- 1 x)) (log (+ 1 x)))
45.0ms
(log (- 1 x))
23.0ms
(log (+ 1 x))

simplify2.0s

Counts
63 → 75
Calls
63 calls:
Slowest
321.0ms
(- (+ (/ 1 x) (log -1)) (+ (log (/ -1 x)) (* 1/2 (/ 1 (pow x 2)))))
201.0ms
(- (log -1) (+ (log (/ 1 x)) (+ (* 1/2 (/ 1 (pow x 2))) (/ 1 x))))
179.0ms
(- (+ x (+ (* 1/3 (pow x 3)) (* 1/2 (pow x 2)))))
159.0ms
(- (+ (log (/ -1 x)) (+ (* 1/2 (/ 1 (pow x 2))) (/ 1 x))))
147.0ms
(- (/ 1 x) (+ (log (/ 1 x)) (* 1/2 (/ 1 (pow x 2)))))

prune730.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.0b

localize12.0ms

Local error

Found 1 expressions with local error:

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

rewrite6.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
associate--l+
sub-neg
flip--
add-cube-cbrt
add-exp-log
diff-log
add-cbrt-cube
flip3--
*-un-lft-identity
pow1
add-sqr-sqrt
associate--l-
Counts
1 → 15
Calls
1 calls:
Slowest
6.0ms
(- (- -1 x) (* x (* x 1/2)))

series9.0ms

Counts
1 → 3
Calls
1 calls:
Slowest
9.0ms
(- (- -1 x) (* x (* x 1/2)))

simplify361.0ms

Counts
4 → 18
Calls
4 calls:
Slowest
133.0ms
(/ (exp (- -1 x)) (exp (* x (* x 1/2))))
83.0ms
(- (+ x (+ (* 1/2 (pow x 2)) 1)))
81.0ms
(- (+ x (+ (* 1/2 (pow x 2)) 1)))
63.0ms
(- (+ x (+ (* 1/2 (pow x 2)) 1)))

prune90.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.0b

localize5.0ms

Local error

Found 0 expressions with local error:

rewrite0.0ms

Algorithm
rewrite-expression-head
Rules
Counts
0 → 0
Calls
0 calls:
Slowest

series0.0ms

Counts
0 → 0
Calls
0 calls:
Slowest

simplify0.0ms

Counts
0 → 0
Calls
0 calls:
Slowest

prune3.0ms

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0.0b

localize11.0ms

Local error

Found 4 expressions with local error:

6.3b
(log (sqrt (+ 1 x)))
6.3b
(log (sqrt (+ 1 x)))
6.2b
(log (- 1 x))
0.0b
(/ (log (- 1 x)) (+ (log (sqrt (+ 1 x))) (log (sqrt (+ 1 x)))))

rewrite31.0ms

Algorithm
rewrite-expression-head
Rules
97×log-pow
86×*-un-lft-identity
84×times-frac
79×pow1
56×add-cube-cbrt
56×add-sqr-sqrt
35×distribute-lft-out
35×distribute-rgt-out
22×pow1/2
21×associate-/r*
15×log-prod
10×distribute-rgt1-in
10×distribute-lft1-in
add-exp-log
log-div
sqrt-prod
add-cbrt-cube
add-log-exp
associate-/l*
sqrt-div
flip-+
rem-log-exp
flip3-+
flip--
associate-/r/
div-sub
flip3--
div-inv
div-exp
frac-2neg
clear-num
cbrt-undiv
Counts
4 → 175
Calls
4 calls:
Slowest
23.0ms
(/ (log (- 1 x)) (+ (log (sqrt (+ 1 x))) (log (sqrt (+ 1 x)))))
1.0ms
(log (sqrt (+ 1 x)))
1.0ms
(log (sqrt (+ 1 x)))
1.0ms
(log (- 1 x))

series245.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
139.0ms
(/ (log (- 1 x)) (+ (log (sqrt (+ 1 x))) (log (sqrt (+ 1 x)))))
41.0ms
(log (sqrt (+ 1 x)))
37.0ms
(log (- 1 x))
27.0ms
(log (sqrt (+ 1 x)))

simplify2.5s

Counts
233 → 187
Calls
233 calls:
Slowest
244.0ms
(- (log -1) (+ (log (/ 1 x)) (+ (* 1/2 (/ 1 (pow x 2))) (/ 1 x))))
197.0ms
(- (+ x (+ (* 1/3 (pow x 3)) (* 1/2 (pow x 2)))))
155.0ms
(/ (* (* (log (- 1 x)) (log (- 1 x))) (log (- 1 x))) (* (* (+ (log (sqrt (+ 1 x))) (log (sqrt (+ 1 x)))) (+ (log (sqrt (+ 1 x))) (log (sqrt (+ 1 x))))) (+ (log (sqrt (+ 1 x))) (log (sqrt (+ 1 x))))))
145.0ms
(- (+ (log (/ -1 x)) (+ (* 1/2 (/ 1 (pow x 2))) (/ 1 x))))
129.0ms
(- (+ (* 1/2 x) (* 1/6 (pow x 3))) (* 1/4 (pow x 2)))

prune1.2s

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0.0b

regimes76.0ms

Accuracy

0% (0.4b remaining)

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

bsearch2.0ms

end0.0ms

sample9.1s

Algorithm
intervals
Results
5.9s3449×body1280valid
2.0s2427×body640valid
658.0ms1277×body320valid
300.0ms8000×pre80true
194.0ms626×body160valid
50.0ms221×body80valid