Average Error: 14.6 → 0.0
Time: 21.1s
Precision: 64
Internal Precision: 128
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.3523329577305727 \cdot 10^{+154} \lor \neg \left(x \le 439.23543538614194\right):\\ \;\;\;\;\left(\frac{1}{x} + \frac{1}{{x}^{5}}\right) - \frac{1}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{\sqrt{x \cdot x + 1}}}{\sqrt{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

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

Derivation

  1. Split input into 2 regimes
  2. if x < -1.3523329577305727e+154 or 439.23543538614194 < x

    1. Initial program 40.8

      \[\frac{x}{x \cdot x + 1}\]
    2. Initial simplification40.8

      \[\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 -1.3523329577305727e+154 < x < 439.23543538614194

    1. Initial program 0.1

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

      \[\leadsto \frac{x}{x \cdot x + 1}\]
    3. Using strategy rm
    4. Applied add-sqr-sqrt0.1

      \[\leadsto \frac{x}{\color{blue}{\sqrt{x \cdot x + 1} \cdot \sqrt{x \cdot x + 1}}}\]
    5. Applied associate-/r*0.0

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

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

Reproduce

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

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

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

Details

Time bar (total: 18.9s)Debug log

start24.0ms

Algorithm
intervals

setup10.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 17.7b

localize10.0ms

Local error

Found 1 expressions with local error:

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

rewrite2.0ms

Algorithm
rewrite-expression-head
Counts
1 → 15
Calls

1 calls. Slowest were:

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

series18.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

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

simplify421.0ms

Counts
8 → 18
Calls

8 calls. Slowest were:

263.0ms
(+ (* (* x x) (* x x)) (- (* 1 1) (* (* x x) 1)))
43.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
40.0ms
(- (+ x (pow x 5)) (pow x 3))

prune148.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0b

localize9.0ms

Local error

Found 4 expressions with local error:

17.7b
(sqrt (+ (* x x) 1))
17.7b
(sqrt (+ (* x x) 1))
0.0b
(/ (/ x (sqrt (+ (* x x) 1))) (sqrt (+ (* x x) 1)))
0.0b
(/ x (sqrt (+ (* x x) 1)))

rewrite15.0ms

Algorithm
rewrite-expression-head
Counts
4 → 109
Calls

4 calls. Slowest were:

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

series120.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

44.0ms
(/ x (sqrt (+ (* x x) 1)))
30.0ms
(/ (/ x (sqrt (+ (* x x) 1))) (sqrt (+ (* x x) 1)))
28.0ms
(sqrt (+ (* x x) 1))
18.0ms
(sqrt (+ (* x x) 1))

simplify6.0s

Counts
118 → 121
Calls

118 calls. Slowest were:

312.0ms
(/ (sqrt (+ (* (* x x) (* x x)) (- (* 1 1) (* (* x x) 1)))) (sqrt (cbrt (+ (* x x) 1))))
303.0ms
(/ (sqrt (+ (* (* x x) (* x x)) (- (* 1 1) (* (* x x) 1)))) (sqrt (+ (* x x) 1)))
297.0ms
(sqrt (+ (* (* x x) (* x x)) (- (* 1 1) (* (* x x) 1))))

prune1.3s

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0b

localize23.0ms

Local error

Found 4 expressions with local error:

23.2b
(cbrt (* (* (sqrt (+ (* x x) 1)) (sqrt (+ (* x x) 1))) (sqrt (+ (* x x) 1))))
17.7b
(sqrt (+ (* x x) 1))
17.7b
(sqrt (+ (* x x) 1))
17.7b
(sqrt (+ (* x x) 1))

rewrite23.0ms

Algorithm
rewrite-expression-head
Counts
4 → 78
Calls

4 calls. Slowest were:

15.0ms
(cbrt (* (* (sqrt (+ (* x x) 1)) (sqrt (+ (* x x) 1))) (sqrt (+ (* x x) 1))))
2.0ms
(sqrt (+ (* x x) 1))
2.0ms
(sqrt (+ (* x x) 1))

series86.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

27.0ms
(sqrt (+ (* x x) 1))
24.0ms
(sqrt (+ (* x x) 1))
18.0ms
(cbrt (* (* (sqrt (+ (* x x) 1)) (sqrt (+ (* x x) 1))) (sqrt (+ (* x x) 1))))
17.0ms
(sqrt (+ (* x x) 1))

simplify6.1s

Counts
58 → 90
Calls

58 calls. Slowest were:

370.0ms
(cbrt (* (* (sqrt (+ (pow (* x x) 3) (pow 1 3))) (sqrt (+ (pow (* x x) 3) (pow 1 3)))) (sqrt (- (* (* x x) (* x x)) (* 1 1)))))
311.0ms
(cbrt (* (* (sqrt (+ (* x x) 1)) (sqrt (+ (* x x) 1))) (sqrt (- (* (* x x) (* x x)) (* 1 1)))))
255.0ms
(cbrt (* (* (sqrt (- (* (* x x) (* x x)) (* 1 1))) (sqrt (+ (* x x) 1))) (sqrt (+ (* x x) 1))))

prune1.3s

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0b

localize43.0ms

Local error

Found 3 expressions with local error:

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

rewrite53.0ms

Algorithm
rewrite-expression-head
Counts
3 → 64
Calls

3 calls. Slowest were:

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

series61.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

26.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
18.0ms
(/ 1 (pow x 5))
17.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))
264.0ms
(- (* (+ (* 1 x) (* (pow x 5) 1)) (pow x 3)) (* (* (pow x 5) x) 1))
224.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))

prune889.0ms

Pruning

3 alts after pruning (0 fresh and 3 done)

Merged error: 0b

regimes56.0ms

Accuracy

100% (0.0b remaining)

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

bsearch142.0ms