Average Error: 14.9 → 0.0
Time: 23.1s
Precision: 64
Internal Precision: 128
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -16800330478070782.0 \lor \neg \left(x \le 521.0581431275527\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[3]{\sqrt{x \cdot x + 1} \cdot \left(\sqrt{x \cdot x + 1} \cdot \sqrt{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

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

Derivation

  1. Split input into 2 regimes
  2. if x < -16800330478070782.0 or 521.0581431275527 < x

    1. Initial program 30.9

      \[\frac{x}{x \cdot x + 1}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt30.9

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

      \[\leadsto \color{blue}{\frac{\frac{x}{\sqrt{x \cdot x + 1}}}{\sqrt{x \cdot x + 1}}}\]
    5. Taylor expanded around -inf 0.0

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

    if -16800330478070782.0 < x < 521.0581431275527

    1. Initial program 0.0

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

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

      \[\leadsto \color{blue}{\frac{\frac{x}{\sqrt{x \cdot x + 1}}}{\sqrt{x \cdot x + 1}}}\]
    5. Using strategy rm
    6. Applied add-cbrt-cube0.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -16800330478070782.0 \lor \neg \left(x \le 521.0581431275527\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[3]{\sqrt{x \cdot x + 1} \cdot \left(\sqrt{x \cdot x + 1} \cdot \sqrt{x \cdot x + 1}\right)}}\\ \end{array}\]

Reproduce

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

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

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

Details

Time bar (total: 22.7s)Debug log

sample27.0ms

Algorithm
intervals
Results
19.0ms256×body80valid

simplify4.0ms

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

prune12.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 13.7b

localize9.0ms

Local error

Found 1 expressions with local error:

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

series19.0ms

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

simplify316.0ms

Counts
8 → 18
Calls
8 calls:
Slowest
205.0ms
(+ (* (* x x) (* x x)) (- (* 1 1) (* (* x x) 1)))
34.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
30.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
17.0ms
(- (+ x (pow x 5)) (pow x 3))
16.0ms
(- (* x x) 1)

prune109.0ms

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0b

localize15.0ms

Local error

Found 4 expressions with local error:

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

rewrite16.0ms

Algorithm
rewrite-expression-head
Rules
36×times-frac
31×add-sqr-sqrt
30×sqrt-prod
29×add-cube-cbrt
29×*-un-lft-identity
22×sqrt-div
18×associate-/r/
12×associate-/r*
11×flip-+
11×flip3-+
div-inv
associate-/l*
add-exp-log
add-cbrt-cube
add-log-exp
pow1
pow1/2
frac-2neg
clear-num
rem-sqrt-square
associate-/l/
div-exp
cbrt-undiv
Counts
4 → 109
Calls
4 calls:
Slowest
9.0ms
(/ (/ x (sqrt (+ (* x x) 1))) (sqrt (+ (* x x) 1)))
2.0ms
(sqrt (+ (* x x) 1))
2.0ms
(sqrt (+ (* x x) 1))
1.0ms
(/ x (sqrt (+ (* x x) 1)))

series115.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
37.0ms
(/ x (sqrt (+ (* x x) 1)))
27.0ms
(sqrt (+ (* x x) 1))
26.0ms
(/ (/ x (sqrt (+ (* x x) 1))) (sqrt (+ (* x x) 1)))
26.0ms
(sqrt (+ (* x x) 1))

simplify5.0s

Counts
118 → 121
Calls
118 calls:
Slowest
272.0ms
(/ (sqrt (+ (* (* x x) (* x x)) (- (* 1 1) (* (* x x) 1)))) (sqrt (sqrt (+ (* x x) 1))))
230.0ms
(/ (sqrt (+ (* (* x x) (* x x)) (- (* 1 1) (* (* x x) 1)))) (sqrt (+ (* x x) 1)))
225.0ms
(/ (sqrt (+ (* (* x x) (* x x)) (- (* 1 1) (* (* x x) 1)))) (sqrt (cbrt (+ (* x x) 1))))
215.0ms
(/ (* (* (/ x (sqrt (+ (* x x) 1))) (/ x (sqrt (+ (* x x) 1)))) (/ x (sqrt (+ (* x x) 1)))) (* (* (sqrt (+ (* x x) 1)) (sqrt (+ (* x x) 1))) (sqrt (+ (* x x) 1))))
203.0ms
(/ (sqrt (+ (* (* x x) (* x x)) (- (* 1 1) (* (* x x) 1)))) (sqrt (+ (* x x) 1)))

prune993.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0b

localize21.0ms

Local error

Found 4 expressions with local error:

17.3b
(cbrt (* (* (sqrt (+ (* x x) 1)) (sqrt (+ (* x x) 1))) (sqrt (+ (* x x) 1))))
13.6b
(sqrt (+ (* x x) 1))
13.6b
(sqrt (+ (* x x) 1))
13.6b
(sqrt (+ (* x x) 1))

rewrite43.0ms

Algorithm
rewrite-expression-head
Rules
60×sqrt-div
30×flip-+
30×flip3-+
28×frac-times
26×cbrt-div
14×associate-*l/
10×add-sqr-sqrt
sqrt-prod
associate-*r/
add-cube-cbrt
*-un-lft-identity
add-log-exp
add-exp-log
add-cbrt-cube
pow1
pow1/2
rem-sqrt-square
rem-cbrt-cube
pow3
pow1/3
cbrt-prod
Counts
4 → 78
Calls
4 calls:
Slowest
29.0ms
(cbrt (* (* (sqrt (+ (* x x) 1)) (sqrt (+ (* x x) 1))) (sqrt (+ (* x x) 1))))
4.0ms
(sqrt (+ (* x x) 1))
4.0ms
(sqrt (+ (* x x) 1))
4.0ms
(sqrt (+ (* x x) 1))

series109.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
30.0ms
(sqrt (+ (* x x) 1))
27.0ms
(cbrt (* (* (sqrt (+ (* x x) 1)) (sqrt (+ (* x x) 1))) (sqrt (+ (* x x) 1))))
26.0ms
(sqrt (+ (* x x) 1))
26.0ms
(sqrt (+ (* x x) 1))

simplify6.1s

Counts
58 → 90
Calls
58 calls:
Slowest
501.0ms
(- (+ x (* 1/2 (/ 1 x))) (* 1/8 (/ 1 (pow x 3))))
422.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)))))
262.0ms
(cbrt (* (* (sqrt (+ (* x x) 1)) (sqrt (+ (* x x) 1))) (sqrt (- (* (* x x) (* x x)) (* 1 1)))))
198.0ms
(cbrt (* (* (sqrt (- (* (* x x) (* x x)) (* 1 1))) (sqrt (+ (pow (* x x) 3) (pow 1 3)))) (sqrt (- (* (* x x) (* x x)) (* 1 1)))))
189.0ms
(cbrt (* (* (sqrt (- (* (* x x) (* x x)) (* 1 1))) (sqrt (+ (pow (* x x) 3) (pow 1 3)))) (sqrt (+ (pow (* x x) 3) (pow 1 3)))))

prune927.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0b

localize14.0ms

Local error

Found 4 expressions with local error:

17.9b
(* (/ x (- (* (* x x) (* x x)) (* 1 1))) (- (* x x) 1))
2.2b
(/ x (- (* (* x x) (* x x)) (* 1 1)))
0.2b
(* (* x x) (* x x))
0.0b
(- (* x x) 1)

rewrite29.0ms

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

series145.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
57.0ms
(/ x (- (* (* x x) (* x x)) (* 1 1)))
50.0ms
(* (/ x (- (* (* x x) (* x x)) (* 1 1))) (- (* x x) 1))
25.0ms
(- (* x x) 1)
13.0ms
(* (* x x) (* x x))

simplify7.2s

Counts
49 → 88
Calls
49 calls:
Slowest
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)))
678.0ms
(* (- 1) (/ x (- (* (* x x) (* x x)) (* 1 1))))
587.0ms
(* (- 1) (/ x (- (* (* x x) (* x x)) (* 1 1))))
559.0ms
(* (/ x (- (* (* x x) (* x x)) (* 1 1))) (- 1))
489.0ms
(* (/ x (- (* (* x x) (* x x)) (* 1 1))) (- 1))

prune669.0ms

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0b

regimes38.0ms

Accuracy

99.9% (0.0b remaining)

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

bsearch118.0ms

end0.0ms

sample703.0ms

Algorithm
intervals
Results
608.0ms8000×body80valid