Average Error: 14.9 → 0.0
Time: 15.7s
Precision: 64
Internal Precision: 128
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -32889.63765713185 \lor \neg \left(x \le 425.99930081705185\right):\\ \;\;\;\;\left(\frac{1}{x} + \frac{1}{{x}^{5}}\right) - \frac{1}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-x\right) + {x}^{3}}{-1 + {x}^{4}}\\ \end{array}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Split input into 2 regimes
  2. if x < -32889.63765713185 or 425.99930081705185 < x

    1. Initial program 30.0

      \[\frac{x}{x \cdot x + 1}\]
    2. Using strategy rm
    3. Applied flip-+47.6

      \[\leadsto \frac{x}{\color{blue}{\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) - 1 \cdot 1}{x \cdot x - 1}}}\]
    4. Applied associate-/r/47.7

      \[\leadsto \color{blue}{\frac{x}{\left(x \cdot x\right) \cdot \left(x \cdot x\right) - 1 \cdot 1} \cdot \left(x \cdot x - 1\right)}\]
    5. Taylor expanded around inf 0.0

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

    if -32889.63765713185 < x < 425.99930081705185

    1. Initial program 0.0

      \[\frac{x}{x \cdot x + 1}\]
    2. Using strategy rm
    3. Applied flip-+0.0

      \[\leadsto \frac{x}{\color{blue}{\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) - 1 \cdot 1}{x \cdot x - 1}}}\]
    4. Applied associate-/r/0.0

      \[\leadsto \color{blue}{\frac{x}{\left(x \cdot x\right) \cdot \left(x \cdot x\right) - 1 \cdot 1} \cdot \left(x \cdot x - 1\right)}\]
    5. Using strategy rm
    6. Applied pow10.0

      \[\leadsto \frac{x}{\left(x \cdot x\right) \cdot \left(x \cdot x\right) - 1 \cdot 1} \cdot \color{blue}{{\left(x \cdot x - 1\right)}^{1}}\]
    7. Applied pow10.0

      \[\leadsto \color{blue}{{\left(\frac{x}{\left(x \cdot x\right) \cdot \left(x \cdot x\right) - 1 \cdot 1}\right)}^{1}} \cdot {\left(x \cdot x - 1\right)}^{1}\]
    8. Applied pow-prod-down0.0

      \[\leadsto \color{blue}{{\left(\frac{x}{\left(x \cdot x\right) \cdot \left(x \cdot x\right) - 1 \cdot 1} \cdot \left(x \cdot x - 1\right)\right)}^{1}}\]
    9. Simplified0.0

      \[\leadsto {\color{blue}{\left(\frac{\left(-x\right) + {x}^{3}}{-1 + {x}^{4}}\right)}}^{1}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -32889.63765713185 \lor \neg \left(x \le 425.99930081705185\right):\\ \;\;\;\;\left(\frac{1}{x} + \frac{1}{{x}^{5}}\right) - \frac{1}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-x\right) + {x}^{3}}{-1 + {x}^{4}}\\ \end{array}\]

Reproduce

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

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

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

Details

Time bar (total: 15.2s)Debug log

sample34.0ms

Algorithm
intervals

simplify4.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune7.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 17.8b

localize17.0ms

Local error

Found 1 expressions with local error:

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

rewrite3.0ms

Algorithm
rewrite-expression-head
Counts
1 → 15
Calls

1 calls. Slowest were:

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

series31.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

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

simplify394.0ms

Counts
8 → 18
Calls

8 calls. Slowest were:

239.0ms
(+ (* (* x x) (* x x)) (- (* 1 1) (* (* x x) 1)))
59.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
40.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))

prune106.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.0b

localize35.0ms

Local error

Found 3 expressions with local error:

23.2b
(* (/ x (- (* (* x x) (* x x)) (* 1 1))) (- (* x x) 1))
2.6b
(/ x (- (* (* x x) (* x x)) (* 1 1)))
0.1b
(* (* x x) (* x x))

rewrite35.0ms

Algorithm
rewrite-expression-head
Counts
3 → 64
Calls

3 calls. Slowest were:

20.0ms
(* (/ x (- (* (* x x) (* x x)) (* 1 1))) (- (* x x) 1))
7.0ms
(/ x (- (* (* x x) (* x x)) (* 1 1)))
7.0ms
(* (* x x) (* x x))

series113.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

63.0ms
(/ x (- (* (* x x) (* x x)) (* 1 1)))
31.0ms
(* (/ x (- (* (* x x) (* x x)) (* 1 1))) (- (* x x) 1))
19.0ms
(* (* x x) (* x x))

simplify8.1s

Counts
45 → 73
Calls

45 calls. Slowest were:

1.7s
(* (* (* (/ x (- (* (* x x) (* x x)) (* 1 1))) (/ x (- (* (* x x) (* x x)) (* 1 1)))) (/ x (- (* (* x x) (* x x)) (* 1 1)))) (* (* (- (* x x) 1) (- (* x x) 1)) (- (* x x) 1)))
1.1s
(* (- 1) (/ x (- (* (* x x) (* x x)) (* 1 1))))
715.0ms
(* (- 1) (/ x (- (* (* x x) (* x x)) (* 1 1))))

prune596.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0b

localize37.0ms

Local error

Found 2 expressions with local error:

26.1b
(/ (+ (- x) (pow x 3)) (+ -1 (pow x 4)))
0.0b
(+ (- x) (pow x 3))

rewrite32.0ms

Algorithm
rewrite-expression-head
Counts
2 → 54
Calls

2 calls. Slowest were:

24.0ms
(/ (+ (- x) (pow x 3)) (+ -1 (pow x 4)))
7.0ms
(+ (- x) (pow x 3))

series81.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

45.0ms
(/ (+ (- x) (pow x 3)) (+ -1 (pow x 4)))
37.0ms
(+ (- x) (pow x 3))

simplify1.3s

Counts
51 → 60
Calls

51 calls. Slowest were:

165.0ms
(+ (* -1 -1) (- (* (pow x 4) (pow x 4)) (* -1 (pow x 4))))
161.0ms
(- (* (- x) (- x)) (* (pow x 3) (pow x 3)))
94.0ms
(/ (* (* (+ (- x) (pow x 3)) (+ (- x) (pow x 3))) (+ (- x) (pow x 3))) (* (* (+ -1 (pow x 4)) (+ -1 (pow x 4))) (+ -1 (pow x 4))))

prune597.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0b

localize17.0ms

Local error

Found 3 expressions with local error:

17.7b
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
0.4b
(/ 1 (pow x 3))
0.1b
(/ 1 (pow x 5))

rewrite26.0ms

Algorithm
rewrite-expression-head
Counts
3 → 64
Calls

3 calls. Slowest were:

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

series63.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

28.0ms
(/ 1 (pow x 5))
22.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
13.0ms
(/ 1 (pow x 3))

simplify2.0s

Counts
39 → 73
Calls

39 calls. Slowest were:

351.0ms
(* (- (/ 1 (pow x 5)) (/ 1 x)) (pow x 3))
243.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))
204.0ms
(- (* (+ (* 1 x) (* (pow x 5) 1)) (pow x 3)) (* (* (pow x 5) x) 1))

prune693.0ms

Pruning

2 alts after pruning (0 fresh and 2 done)

Merged error: 0b

regimes53.0ms

Accuracy

100% (0.0b remaining)

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

bsearch102.0ms

end0.0ms

sample728.0ms

Algorithm
intervals