Average Error: 15.2 → 0.0
Time: 11.8s
Precision: 64
Internal Precision: 128
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -7.139704922729192 \cdot 10^{+49} \lor \neg \left(x \le 808.0974661765623\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

Target

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

Derivation

  1. Split input into 2 regimes
  2. if x < -7.139704922729192e+49 or 808.0974661765623 < x

    1. Initial program 33.0

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

      \[\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 -7.139704922729192e+49 < x < 808.0974661765623

    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 -7.139704922729192 \cdot 10^{+49} \lor \neg \left(x \le 808.0974661765623\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 2018362 +o rules:numerics
(FPCore (x)
  :name "x / (x^2 + 1)"

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

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

Details

Time bar (total: 10.2s)Debug log

start46.0ms

Algorithm
intervals

setup19.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 13.1b

localize15.0ms

Local error

Found 1 expressions with local error:

13.1b
(/ x (fma x x 1))

rewrite1.0ms

Algorithm
rewrite-expression-head
Counts
1 → 15
Calls

1 calls. Slowest were:

1.0ms
(/ x (fma x x 1))

series25.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

25.0ms
(/ x (fma x x 1))

simplify127.0ms

Counts
6 → 18
Calls

6 calls. Slowest were:

47.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
41.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
33.0ms
(- (+ x (pow x 5)) (pow x 3))

prune141.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0b

localize40.0ms

Local error

Found 4 expressions with local error:

22.2b
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
0.1b
(/ 1 (pow x 5))
0.1b
(/ 1 (pow x 3))
0.0b
(+ (/ 1 (pow x 5)) (/ 1 x))

rewrite53.0ms

Algorithm
rewrite-expression-head
Counts
4 → 127
Calls

4 calls. Slowest were:

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

series96.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

46.0ms
(+ (/ 1 (pow x 5)) (/ 1 x))
18.0ms
(/ 1 (pow x 5))
17.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
15.0ms
(/ 1 (pow x 3))

simplify7.9s

Counts
109 → 139
Calls

109 calls. Slowest were:

418.0ms
(* (- (/ 1 (pow x 5)) (/ 1 x)) (pow x 3))
320.0ms
(- (* (+ (* 1 x) (* (pow x 5) 1)) (pow x 3)) (* (* (pow x 5) x) 1))
294.0ms
(- (* (- (* (/ 1 (pow x 5)) (/ 1 (pow x 5))) (* (/ 1 x) (/ 1 x))) (pow x 3)) (* (- (/ 1 (pow x 5)) (/ 1 x)) 1))

prune1.6s

Pruning

2 alts after pruning (0 fresh and 2 done)

Merged error: 0b

regimes25.0ms

Accuracy

99.9% (0.0b remaining)

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

bsearch125.0ms