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

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Split input into 2 regimes
  2. if x < -136879010729.43633 or 5499.922499700308 < x

    1. Initial program 31.0

      \[\frac{x}{x \cdot x + 1}\]
    2. Using strategy rm
    3. Applied div-inv31.0

      \[\leadsto \color{blue}{x \cdot \frac{1}{x \cdot x + 1}}\]
    4. Using strategy rm
    5. Applied flip-+48.2

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

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

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

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

    if -136879010729.43633 < x < 5499.922499700308

    1. Initial program 0.0

      \[\frac{x}{x \cdot x + 1}\]
    2. Using strategy rm
    3. Applied div-inv0.0

      \[\leadsto \color{blue}{x \cdot \frac{1}{x \cdot x + 1}}\]
    4. Using strategy rm
    5. Applied flip-+0.0

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

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

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

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

Reproduce

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

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

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

Details

Time bar (total: 16.0s)Debug log

sample16.0ms

Algorithm
intervals
Results
256×(pre true 80)
256×(body real 80)

simplify3.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
2.0ms
(/ x (+ (* x x) 1))

prune4.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 14.4b

localize12.0ms

Local error

Found 1 expressions with local error:

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

rewrite2.0ms

Algorithm
rewrite-expression-head
Rules
associate-/r*
add-cube-cbrt
associate-/r/
*-un-lft-identity
add-sqr-sqrt
add-log-exp
div-inv
flip-+
add-exp-log
add-cbrt-cube
flip3-+
frac-2neg
clear-num
pow1
Counts
1 → 15
Calls
1 calls:
Slowest
1.0ms
(/ x (+ (* x x) 1))

series29.0ms

Counts
1 → 3
Calls
1 calls:
Slowest
29.0ms
(/ x (+ (* x x) 1))

simplify414.0ms

Counts
8 → 18
Calls
8 calls:
Slowest
258.0ms
(+ (* (* x x) (* x x)) (- (* 1 1) (* (* x x) 1)))
52.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
47.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
24.0ms
(- (* x x) 1)
20.0ms
(- (+ x (pow x 5)) (pow x 3))

prune106.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0b

localize6.0ms

Local error

Found 2 expressions with local error:

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

rewrite4.0ms

Algorithm
rewrite-expression-head
Rules
associate-*r*
add-cube-cbrt
associate-/r/
*-un-lft-identity
add-sqr-sqrt
add-exp-log
associate-/r*
pow1
add-log-exp
div-inv
flip-+
add-cbrt-cube
flip3-+
inv-pow
pow-flip
*-commutative
un-div-inv
associate-*r/
frac-2neg
clear-num
rec-exp
Counts
2 → 34
Calls
2 calls:
Slowest
2.0ms
(/ 1 (+ (* x x) 1))
2.0ms
(* x (/ 1 (+ (* x x) 1)))

series47.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
27.0ms
(* x (/ 1 (+ (* x x) 1)))
20.0ms
(/ 1 (+ (* x x) 1))

simplify829.0ms

Counts
20 → 40
Calls
20 calls:
Slowest
276.0ms
(+ (* (* x x) (* x x)) (- (* 1 1) (* (* x x) 1)))
225.0ms
(+ (* (* x x) (* x x)) (- (* 1 1) (* (* x x) 1)))
56.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
39.0ms
(- (+ x (pow x 5)) (pow x 3))
38.0ms
(- (+ (/ 1 (pow x 2)) (/ 1 (pow x 6))) (/ 1 (pow x 4)))

prune285.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0b

localize38.0ms

Local error

Found 4 expressions with local error:

20.4b
(* (* x (/ 1 (- (* (* x x) (* x x)) (* 1 1)))) (- (* x x) 1))
2.6b
(* x (/ 1 (- (* (* x x) (* x x)) (* 1 1))))
0.3b
(/ 1 (- (* (* x x) (* x x)) (* 1 1)))
0.1b
(* (* x x) (* x x))

rewrite41.0ms

Algorithm
rewrite-expression-head
Rules
12×pow1
11×associate-*r*
add-exp-log
add-cbrt-cube
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
associate-*r/
flip--
flip3--
pow2
add-log-exp
un-div-inv
associate-/r/
associate-/r*
frac-times
*-commutative
pow-prod-down
div-inv
cbrt-unprod
pow-prod-up
prod-exp
associate-*l/
associate-*l*
distribute-lft-in
sub-neg
distribute-rgt-in
difference-of-squares
inv-pow
pow-flip
difference-of-sqr-1
pow-plus
frac-2neg
clear-num
rec-exp
Counts
4 → 81
Calls
4 calls:
Slowest
25.0ms
(* (* x (/ 1 (- (* (* x x) (* x x)) (* 1 1)))) (- (* x x) 1))
6.0ms
(/ 1 (- (* (* x x) (* x x)) (* 1 1)))
5.0ms
(* x (/ 1 (- (* (* x x) (* x x)) (* 1 1))))
4.0ms
(* (* x x) (* x x))

series146.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
52.0ms
(* x (/ 1 (- (* (* x x) (* x x)) (* 1 1))))
47.0ms
(* (* x (/ 1 (- (* (* x x) (* x x)) (* 1 1)))) (- (* x x) 1))
33.0ms
(/ 1 (- (* (* x x) (* x x)) (* 1 1)))
14.0ms
(* (* x x) (* x x))

simplify9.3s

Counts
58 → 93
Calls
58 calls:
Slowest
1.2s
(* (* x (/ 1 (- (* (* x x) (* x x)) (* 1 1)))) (- 1))
1.1s
(* (- 1) (* x (/ 1 (- (* (* x x) (* x x)) (* 1 1)))))
887.0ms
(* (- 1) (* x (/ 1 (- (* (* x x) (* x x)) (* 1 1)))))
862.0ms
(* (* x (/ 1 (- (* (* x x) (* x x)) (* 1 1)))) (- 1))
494.0ms
(* x (- (* x x) 1))

prune827.0ms

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0b

localize41.0ms

Local error

Found 4 expressions with local error:

18.7b
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
0.9b
(/ 1 (pow x 3))
0.4b
(/ 1 (pow x 5))
0.0b
(+ (/ 1 (pow x 5)) (/ 1 x))

rewrite63.0ms

Algorithm
rewrite-expression-head
Rules
25×*-un-lft-identity
19×div-inv
12×distribute-lft-out
11×add-log-exp
10×distribute-lft-out--
associate-/r*
add-sqr-sqrt
add-cube-cbrt
add-exp-log
add-cbrt-cube
rec-exp
pow1
frac-sub
inv-pow
pow-flip
flip-+
frac-add
diff-log
flip3-+
frac-2neg
sum-log
clear-num
pow-to-exp
difference-of-squares
flip--
associate--l+
unpow3
flip3--
sub-neg
+-commutative
cube-mult
Counts
4 → 80
Calls
4 calls:
Slowest
50.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
8.0ms
(+ (/ 1 (pow x 5)) (/ 1 x))
1.0ms
(/ 1 (pow x 3))
1.0ms
(/ 1 (pow x 5))

series103.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
34.0ms
(+ (/ 1 (pow x 5)) (/ 1 x))
32.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
20.0ms
(/ 1 (pow x 3))
18.0ms
(/ 1 (pow x 5))

simplify2.1s

Counts
49 → 92
Calls
49 calls:
Slowest
320.0ms
(* (- (/ 1 (pow x 5)) (/ 1 x)) (pow x 3))
302.0ms
(- (* (+ (* 1 x) (* (pow x 5) 1)) (pow x 3)) (* (* (pow x 5) x) 1))
234.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))
178.0ms
(- (* (- (* (/ 1 (pow x 5)) (/ 1 (pow x 5))) (* (/ 1 x) (/ 1 x))) (pow x 3)) (* (- (/ 1 (pow x 5)) (/ 1 x)) 1))
136.0ms
(* (+ (* (/ 1 (pow x 5)) (/ 1 (pow x 5))) (- (* (/ 1 x) (/ 1 x)) (* (/ 1 (pow x 5)) (/ 1 x)))) (pow x 3))

prune831.0ms

Pruning

3 alts after pruning (0 fresh and 3 done)

Merged error: 0b

regimes42.0ms

Accuracy

99.9% (0.0b remaining)

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

bsearch88.0ms

end0.0ms

sample711.0ms

Algorithm
intervals
Results
8000×(pre true 80)
8000×(body real 80)