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

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Split input into 2 regimes
  2. if x < -37260.24691373008 or 391.16595692723325 < x

    1. Initial program 31.0

      \[\frac{x}{x \cdot x + 1}\]
    2. Using strategy rm
    3. Applied flip-+48.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/48.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 flip--55.6

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

      \[\leadsto \color{blue}{\left(\frac{x}{\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) - \left(1 \cdot 1\right) \cdot \left(1 \cdot 1\right)} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) + 1 \cdot 1\right)\right)} \cdot \left(x \cdot x - 1\right)\]
    8. Applied associate-*l*55.7

      \[\leadsto \color{blue}{\frac{x}{\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) - \left(1 \cdot 1\right) \cdot \left(1 \cdot 1\right)} \cdot \left(\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) + 1 \cdot 1\right) \cdot \left(x \cdot x - 1\right)\right)}\]
    9. Simplified55.7

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

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

    if -37260.24691373008 < x < 391.16595692723325

    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 flip--0.0

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

      \[\leadsto \color{blue}{\left(\frac{x}{\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) - \left(1 \cdot 1\right) \cdot \left(1 \cdot 1\right)} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) + 1 \cdot 1\right)\right)} \cdot \left(x \cdot x - 1\right)\]
    8. Applied associate-*l*0.0

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

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

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

Reproduce

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

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

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

Details

Time bar (total: 29.6s)Debug log

sample27.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.0b

localize16.0ms

Local error

Found 1 expressions with local error:

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

rewrite3.0ms

Algorithm
rewrite-expression-head
Counts
1 → 15
Calls

1 calls. Slowest were:

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

series22.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

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

simplify394.0ms

Counts
8 → 18
Calls

8 calls. Slowest were:

250.0ms
(+ (* (* x x) (* x x)) (- (* 1 1) (* (* x x) 1)))
47.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
39.0ms
(- (+ x (pow x 5)) (pow x 3))

prune136.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0b

localize24.0ms

Local error

Found 3 expressions with local error:

21.4b
(* (/ x (- (* (* x x) (* x x)) (* 1 1))) (- (* x x) 1))
1.8b
(/ x (- (* (* x x) (* x x)) (* 1 1)))
0.1b
(* (* x x) (* x x))

rewrite18.0ms

Algorithm
rewrite-expression-head
Counts
3 → 64
Calls

3 calls. Slowest were:

10.0ms
(* (/ x (- (* (* x x) (* x x)) (* 1 1))) (- (* x x) 1))
3.0ms
(/ x (- (* (* x x) (* x x)) (* 1 1)))
3.0ms
(* (* x x) (* x x))

series115.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

55.0ms
(/ x (- (* (* x x) (* x x)) (* 1 1)))
47.0ms
(* (/ x (- (* (* x x) (* x x)) (* 1 1))) (- (* x x) 1))
13.0ms
(* (* x x) (* x x))

simplify7.4s

Counts
45 → 73
Calls

45 calls. Slowest were:

1.6s
(* (* (* (/ 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)))
745.0ms
(* (- 1) (/ x (- (* (* x x) (* x x)) (* 1 1))))
668.0ms
(* (- 1) (/ x (- (* (* x x) (* x x)) (* 1 1))))

prune572.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0b

localize19.0ms

Local error

Found 4 expressions with local error:

25.8b
(* (/ x (+ (* (pow x 7) x) -1)) (* (+ (* (* x x) (* x x)) (* 1 1)) (- (* x x) 1)))
0.7b
(/ x (+ (* (pow x 7) x) -1))
0.1b
(* (* x x) (* x x))
0.1b
(* (+ (* (* x x) (* x x)) (* 1 1)) (- (* x x) 1))

rewrite71.0ms

Algorithm
rewrite-expression-head
Counts
4 → 109
Calls

4 calls. Slowest were:

52.0ms
(* (/ x (+ (* (pow x 7) x) -1)) (* (+ (* (* x x) (* x x)) (* 1 1)) (- (* x x) 1)))
13.0ms
(* (+ (* (* x x) (* x x)) (* 1 1)) (- (* x x) 1))
3.0ms
(* (* x x) (* x x))

series186.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

72.0ms
(* (/ x (+ (* (pow x 7) x) -1)) (* (+ (* (* x x) (* x x)) (* 1 1)) (- (* x x) 1)))
54.0ms
(/ x (+ (* (pow x 7) x) -1))
36.0ms
(* (+ (* (* x x) (* x x)) (* 1 1)) (- (* x x) 1))
23.0ms
(* (* x x) (* x x))

simplify15.4s

Counts
94 → 121
Calls

94 calls. Slowest were:

868.0ms
(* (- (* (* (* x x) (* x x)) (* (* x x) (* x x))) (* (* 1 1) (* 1 1))) (- (* x x) 1))
628.0ms
(* (- (* (* (* x x) (* x x)) (* (* x x) (* x x))) (* (* 1 1) (* 1 1))) (- (pow (* x x) 3) (pow 1 3)))
524.0ms
(* (* (+ (* (* x x) (* x x)) (* 1 1)) (- 1)) (/ x (+ (* (pow x 7) x) -1)))

prune1.4s

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0b

localize23.0ms

Local error

Found 4 expressions with local error:

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

rewrite45.0ms

Algorithm
rewrite-expression-head
Counts
4 → 80
Calls

4 calls. Slowest were:

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

series105.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

49.0ms
(+ (/ 1 (pow x 5)) (/ 1 x))
26.0ms
(/ 1 (pow x 5))
16.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
13.0ms
(/ 1 (pow x 3))

simplify2.0s

Counts
49 → 92
Calls

49 calls. Slowest were:

297.0ms
(* (- (/ 1 (pow x 5)) (/ 1 x)) (pow x 3))
296.0ms
(- (* (+ (* 1 x) (* (pow x 5) 1)) (pow x 3)) (* (* (pow x 5) x) 1))
265.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))

prune701.0ms

Pruning

3 alts after pruning (0 fresh and 3 done)

Merged error: 0b

regimes31.0ms

Accuracy

100% (0.0b remaining)

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

bsearch86.0ms

end0.0ms

sample736.0ms

Algorithm
intervals