Average Error: 15.1 → 0.0
Time: 6.4s
Precision: 64
Internal Precision: 128
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -2.56652978082143 \cdot 10^{+50} \lor \neg \left(x \le 120872261.89181314\right):\\ \;\;\;\;\left(\frac{1}{x} + \frac{1}{{x}^{5}}\right) - \frac{1}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x \cdot x + 1}\\ \end{array}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original15.1
Target0.1
Herbie0.0
\[\frac{1}{x + \frac{1}{x}}\]

Derivation

  1. Split input into 2 regimes
  2. if x < -2.56652978082143e+50 or 120872261.89181314 < x

    1. Initial program 33.7

      \[\frac{x}{x \cdot x + 1}\]
    2. Initial simplification33.7

      \[\leadsto \frac{x}{x \cdot x + 1}\]
    3. Taylor expanded around inf 0.0

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

    if -2.56652978082143e+50 < x < 120872261.89181314

    1. Initial program 0.0

      \[\frac{x}{x \cdot x + 1}\]
    2. Initial simplification0.0

      \[\leadsto \frac{x}{x \cdot x + 1}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -2.56652978082143 \cdot 10^{+50} \lor \neg \left(x \le 120872261.89181314\right):\\ \;\;\;\;\left(\frac{1}{x} + \frac{1}{{x}^{5}}\right) - \frac{1}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x \cdot x + 1}\\ \end{array}\]

Reproduce

herbie shell --seed 2018360 
(FPCore (x)
  :name "x / (x^2 + 1)"

  :herbie-target
  (/ 1 (+ x (/ 1 x)))

  (/ x (+ (* x x) 1)))

Details

Time bar (total: 4.2s)Debug log

start44.0ms

Algorithm
intervals

setup18.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 14.5b

localize17.0ms

Local error

Found 1 expressions with local error:

14.5b
(/ x (+ (* x x) 1))

rewrite3.0ms

Algorithm
rewrite-expression-head
Counts
1 → 15
Calls

1 calls. Slowest were:

3.0ms
(/ x (+ (* x x) 1))

series29.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

29.0ms
(/ x (+ (* x x) 1))

simplify343.0ms

Counts
8 → 18
Calls

8 calls. Slowest were:

218.0ms
(+ (* (* x x) (* x x)) (- (* 1 1) (* (* x x) 1)))
48.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
30.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))

prune176.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0b

localize14.0ms

Local error

Found 1 expressions with local error:

18.2b
(- (+ x (pow x 5)) (pow x 3))

rewrite6.0ms

Algorithm
rewrite-expression-head
Counts
1 → 15
Calls

1 calls. Slowest were:

6.0ms
(- (+ x (pow x 5)) (pow x 3))

series20.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

20.0ms
(- (+ x (pow x 5)) (pow x 3))

simplify159.0ms

Counts
7 → 18
Calls

7 calls. Slowest were:

50.0ms
(/ (exp (+ x (pow x 5))) (exp (pow x 3)))
33.0ms
(- (+ x (pow x 5)) (pow x 3))
25.0ms
(- (+ x (pow x 5)) (pow x 3))

prune148.0ms

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0b

localize24.0ms

Local error

Found 3 expressions with local error:

22.3b
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
0.2b
(/ 1 (pow x 3))
0.1b
(/ 1 (pow x 5))

rewrite32.0ms

Algorithm
rewrite-expression-head
Counts
3 → 64
Calls

3 calls. Slowest were:

29.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
1.0ms
(/ 1 (pow x 5))
1.0ms
(/ 1 (pow x 3))

series74.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

25.0ms
(/ 1 (pow x 5))
25.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
24.0ms
(/ 1 (pow x 3))

simplify1.9s

Counts
39 → 73
Calls

39 calls. Slowest were:

256.0ms
(- (* (+ (pow (/ 1 (pow x 5)) 3) (pow (/ 1 x) 3)) (pow x 3)) (* (+ (* (/ 1 (pow x 5)) (/ 1 (pow x 5))) (- (* (/ 1 x) (/ 1 x)) (* (/ 1 (pow x 5)) (/ 1 x)))) 1))
235.0ms
(- (* (+ (* 1 x) (* (pow x 5) 1)) (pow x 3)) (* (* (pow x 5) x) 1))
218.0ms
(- (* (- (* (/ 1 (pow x 5)) (/ 1 (pow x 5))) (* (/ 1 x) (/ 1 x))) (pow x 3)) (* (- (/ 1 (pow x 5)) (/ 1 x)) 1))

prune994.0ms

Pruning

3 alts after pruning (0 fresh and 3 done)

Merged error: 0b

regimes101.0ms

Accuracy

99.9% (0.0b remaining)

Error of 0.0b against oracle of 0.0b and baseline of 15.1b

bsearch96.0ms