Average Error: 15.2 → 0.0
Time: 6.9s
Precision: 64
Internal Precision: 128
\[\frac{x}{x \cdot x + 1}\]
\[\frac{x}{\sqrt{1^2 + x^2}^*} \cdot \frac{1}{\sqrt{1^2 + x^2}^*}\]

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. Initial program 15.2

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

    \[\leadsto \color{blue}{\frac{x}{(x \cdot x + 1)_*}}\]
  3. Using strategy rm
  4. Applied *-un-lft-identity15.2

    \[\leadsto \frac{x}{\color{blue}{1 \cdot (x \cdot x + 1)_*}}\]
  5. Applied associate-/r*15.2

    \[\leadsto \color{blue}{\frac{\frac{x}{1}}{(x \cdot x + 1)_*}}\]
  6. Using strategy rm
  7. Applied add-sqr-sqrt15.2

    \[\leadsto \frac{\frac{x}{1}}{\color{blue}{\sqrt{(x \cdot x + 1)_*} \cdot \sqrt{(x \cdot x + 1)_*}}}\]
  8. Applied div-inv15.2

    \[\leadsto \frac{\color{blue}{x \cdot \frac{1}{1}}}{\sqrt{(x \cdot x + 1)_*} \cdot \sqrt{(x \cdot x + 1)_*}}\]
  9. Applied times-frac15.1

    \[\leadsto \color{blue}{\frac{x}{\sqrt{(x \cdot x + 1)_*}} \cdot \frac{\frac{1}{1}}{\sqrt{(x \cdot x + 1)_*}}}\]
  10. Simplified15.1

    \[\leadsto \color{blue}{\frac{x}{\sqrt{1^2 + x^2}^*}} \cdot \frac{\frac{1}{1}}{\sqrt{(x \cdot x + 1)_*}}\]
  11. Simplified0.0

    \[\leadsto \frac{x}{\sqrt{1^2 + x^2}^*} \cdot \color{blue}{\frac{1}{\sqrt{1^2 + x^2}^*}}\]
  12. Final simplification0.0

    \[\leadsto \frac{x}{\sqrt{1^2 + x^2}^*} \cdot \frac{1}{\sqrt{1^2 + x^2}^*}\]

Reproduce

herbie shell --seed 2019008 +o rules:numerics
(FPCore (x)
  :name "x / (x^2 + 1)"

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

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

Details

Time bar (total: 6.5s)Debug log

sample30.0ms

Algorithm
intervals

simplify5.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune12.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 13.8b

localize15.0ms

Local error

Found 1 expressions with local error:

13.8b
(/ 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))

series21.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

21.0ms
(/ x (fma x x 1))

simplify134.0ms

Counts
6 → 18
Calls

6 calls. Slowest were:

56.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
39.0ms
(- (+ x (pow x 5)) (pow x 3))
30.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))

prune94.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0b

localize5.0ms

Local error

Found 1 expressions with local error:

13.8b
(/ (/ x 1) (fma x x 1))

rewrite4.0ms

Algorithm
rewrite-expression-head
Counts
1 → 34
Calls

1 calls. Slowest were:

3.0ms
(/ (/ x 1) (fma x x 1))

series25.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

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

simplify498.0ms

Counts
34 → 37
Calls

34 calls. Slowest were:

163.0ms
(/ (* (* (/ x 1) (/ x 1)) (/ x 1)) (* (* (fma x x 1) (fma x x 1)) (fma x x 1)))
60.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
58.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))

prune208.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0b

localize12.0ms

Local error

Found 4 expressions with local error:

0.0b
(/ x (hypot 1 x))
0.0b
(/ 1 (hypot 1 x))
0.0b
(hypot 1 x)
0.0b
(hypot 1 x)

rewrite2.0ms

Algorithm
rewrite-expression-head
Counts
4 → 53
Calls

4 calls. Slowest were:

1.0ms
(/ 1 (hypot 1 x))
1.0ms
(/ x (hypot 1 x))
0.0ms
(hypot 1 x)

series118.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

36.0ms
(/ x (hypot 1 x))
31.0ms
(hypot 1 x)
25.0ms
(/ 1 (hypot 1 x))
25.0ms
(hypot 1 x)

simplify1.7s

Counts
19 → 65
Calls

19 calls. Slowest were:

206.0ms
(- (* 1/8 (/ 1 (pow x 3))) (+ x (* 1/2 (/ 1 x))))
203.0ms
(- (+ x (* 1/2 (/ 1 x))) (* 1/8 (/ 1 (pow x 3))))
196.0ms
(- (+ x (* 1/2 (/ 1 x))) (* 1/8 (/ 1 (pow x 3))))

prune517.0ms

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0b

localize17.0ms

Local error

Found 4 expressions with local error:

0.2b
(/ x (sqrt (hypot 1 x)))
0.0b
(/ 1 (hypot 1 x))
0.0b
(hypot 1 x)
0.0b
(hypot 1 x)

rewrite5.0ms

Algorithm
rewrite-expression-head
Counts
4 → 56
Calls

4 calls. Slowest were:

2.0ms
(/ 1 (hypot 1 x))
1.0ms
(/ x (sqrt (hypot 1 x)))
0.0ms
(hypot 1 x)

series134.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

51.0ms
(/ x (sqrt (hypot 1 x)))
36.0ms
(hypot 1 x)
24.0ms
(/ 1 (hypot 1 x))
23.0ms
(hypot 1 x)

simplify1.5s

Counts
22 → 68
Calls

22 calls. Slowest were:

232.0ms
(- (* 1/2 (/ 1 (pow x 3))) (+ (* 3/8 (/ 1 (pow x 5))) (/ 1 x)))
209.0ms
(- (* 1/8 (/ 1 (pow x 3))) (+ x (* 1/2 (/ 1 x))))
207.0ms
(- (* 1/8 (/ 1 (pow x 3))) (+ x (* 1/2 (/ 1 x))))

prune652.0ms

Pruning

3 alts after pruning (0 fresh and 3 done)

Merged error: 0b

regimes25.0ms

Accuracy

0% (0.0b remaining)

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

bsearch1.0ms

end0.0ms

sample698.0ms

Algorithm
intervals