Average Error: 61.0 → 0.4
Time: 22.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.3
Herbie0.4
\[-\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.4

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

    \[\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.4

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

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

Reproduce

herbie shell --seed 2019022 
(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: 22.6s)Debug log

sample270.0ms

Algorithm
intervals
Results
179.0ms126×body1280valid
53.0ms74×body640valid
14.0ms37×body320valid
8.0ms256×pre80true
4.0ms15×body160valid
0.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: 62.5b

localize22.0ms

Local error

Found 3 expressions with local error:

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

rewrite8.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
5.0ms
(/ (log (- 1 x)) (log (+ 1 x)))
1.0ms
(log (+ 1 x))
1.0ms
(log (- 1 x))

series144.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
80.0ms
(/ (log (- 1 x)) (log (+ 1 x)))
40.0ms
(log (+ 1 x))
24.0ms
(log (- 1 x))

simplify2.1s

Counts
63 → 75
Calls
63 calls:
Slowest
285.0ms
(- (+ (/ 1 x) (log -1)) (+ (log (/ -1 x)) (* 1/2 (/ 1 (pow x 2)))))
249.0ms
(- (log -1) (+ (log (/ 1 x)) (+ (* 1/2 (/ 1 (pow x 2))) (/ 1 x))))
202.0ms
(- (+ x (+ (* 1/3 (pow x 3)) (* 1/2 (pow x 2)))))
197.0ms
(- (+ (log (/ -1 x)) (+ (* 1/2 (/ 1 (pow x 2))) (/ 1 x))))
155.0ms
(- (+ (* 2 (/ 1 (* (pow (log (/ 1 x)) 2) (pow x 2)))) (+ (* 2 (/ 1 (* (log (/ 1 x)) x))) (+ (* 1/2 (/ (log -1) (* (pow (log (/ 1 x)) 2) (pow x 2)))) 1))) (+ (/ (log -1) (* (pow (log (/ 1 x)) 3) (pow x 2))) (+ (/ (log -1) (log (/ 1 x))) (/ (log -1) (* (pow (log (/ 1 x)) 2) x)))))

prune604.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0.0b

localize20.0ms

Local error

Found 1 expressions with local error:

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

rewrite8.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
8.0ms
(- (- -1 x) (* x (* x 1/2)))

series11.0ms

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

simplify415.0ms

Counts
4 → 18
Calls
4 calls:
Slowest
139.0ms
(/ (exp (- -1 x)) (exp (* x (* x 1/2))))
111.0ms
(- (+ x (+ (* 1/2 (pow x 2)) 1)))
91.0ms
(- (+ x (+ (* 1/2 (pow x 2)) 1)))
72.0ms
(- (+ x (+ (* 1/2 (pow x 2)) 1)))

prune109.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.0b

localize10.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

prune5.0ms

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0.0b

localize17.0ms

Local error

Found 4 expressions with local error:

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

rewrite28.0ms

Algorithm
rewrite-expression-head
Rules
18×cbrt-div
15×cbrt-prod
11×add-cube-cbrt
11×*-un-lft-identity
11×add-sqr-sqrt
flip--
flip3--
pow1
pow1/3
add-exp-log
associate-*l*
associate-*r*
add-log-exp
add-cbrt-cube
frac-times
pow-prod-up
associate-*r/
associate-*l/
pow-prod-down
cbrt-unprod
*-commutative
prod-exp
pow-plus
pow2
Counts
4 → 75
Calls
4 calls:
Slowest
19.0ms
(* (cbrt (- (- -1 x) (* x (* x 1/2)))) (cbrt (- (- -1 x) (* x (* x 1/2)))))
3.0ms
(cbrt (- (- -1 x) (* x (* x 1/2))))
3.0ms
(cbrt (- (- -1 x) (* x (* x 1/2))))
2.0ms
(cbrt (- (- -1 x) (* x (* x 1/2))))

series291.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
89.0ms
(* (cbrt (- (- -1 x) (* x (* x 1/2)))) (cbrt (- (- -1 x) (* x (* x 1/2)))))
73.0ms
(cbrt (- (- -1 x) (* x (* x 1/2))))
68.0ms
(cbrt (- (- -1 x) (* x (* x 1/2))))
60.0ms
(cbrt (- (- -1 x) (* x (* x 1/2))))

simplify8.9s

Counts
59 → 87
Calls
59 calls:
Slowest
434.0ms
(* (cbrt (- (pow (- -1 x) 3) (pow (* x (* x 1/2)) 3))) (cbrt (- (- -1 x) (* x (* x 1/2)))))
430.0ms
(* (- (- -1 x) (* x (* x 1/2))) (- (- -1 x) (* x (* x 1/2))))
392.0ms
(* (cbrt (- (pow (- -1 x) 3) (pow (* x (* x 1/2)) 3))) (cbrt (- (* (- -1 x) (- -1 x)) (* (* x (* x 1/2)) (* x (* x 1/2))))))
374.0ms
(+ (* (exp (* 1/3 (- (log 1/2) (* 2 (log (/ 1 x)))))) (cbrt -1)) (+ (* 2/3 (/ (* (exp (* 1/3 (- (log 1/2) (* 2 (log (/ 1 x)))))) (cbrt -1)) x)) (* 2/9 (/ (* (exp (* 1/3 (- (log 1/2) (* 2 (log (/ 1 x)))))) (cbrt -1)) (pow x 2)))))
306.0ms
(* (cbrt (- (* (- -1 x) (- -1 x)) (* (* x (* x 1/2)) (* x (* x 1/2))))) (cbrt (- (pow (- -1 x) 3) (pow (* x (* x 1/2)) 3))))

prune752.0ms

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0.0b

regimes65.0ms

Accuracy

0% (0.4b remaining)

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

bsearch2.0ms

end0.0ms

sample8.8s

Algorithm
intervals
Results
5.5s3438×body1280valid
2.0s2471×body640valid
634.0ms1302×body320valid
257.0ms8000×pre80true
197.0ms573×body160valid
51.0ms216×body80valid