Average Error: 15.2 → 0.8
Time: 9.3s
Precision: 64
Internal Precision: 128
\[\frac{x}{x \cdot x + 1}\]
\[\left(\sqrt[3]{\frac{x}{\sqrt{1^2 + x^2}^*}} \cdot \sqrt[3]{\frac{x}{\sqrt{1^2 + x^2}^*}}\right) \cdot \frac{\sqrt[3]{\frac{x}{\sqrt{1^2 + x^2}^*}}}{\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.8
\[\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 add-sqr-sqrt15.2

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{x}{\sqrt{1^2 + x^2}^*}} \cdot \sqrt[3]{\frac{x}{\sqrt{1^2 + x^2}^*}}\right)} \cdot \frac{\sqrt[3]{\frac{x}{\sqrt{(x \cdot x + 1)_*}}}}{\sqrt{(x \cdot x + 1)_*}}\]
  12. Simplified0.8

    \[\leadsto \left(\sqrt[3]{\frac{x}{\sqrt{1^2 + x^2}^*}} \cdot \sqrt[3]{\frac{x}{\sqrt{1^2 + x^2}^*}}\right) \cdot \color{blue}{\frac{\sqrt[3]{\frac{x}{\sqrt{1^2 + x^2}^*}}}{\sqrt{1^2 + x^2}^*}}\]
  13. Final simplification0.8

    \[\leadsto \left(\sqrt[3]{\frac{x}{\sqrt{1^2 + x^2}^*}} \cdot \sqrt[3]{\frac{x}{\sqrt{1^2 + x^2}^*}}\right) \cdot \frac{\sqrt[3]{\frac{x}{\sqrt{1^2 + x^2}^*}}}{\sqrt{1^2 + x^2}^*}\]

Reproduce

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

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

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

Details

Time bar (total: 8.8s)Debug log

sample16.0ms

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

simplify2.0ms

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

prune11.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 14.4b

localize14.0ms

Local error

Found 1 expressions with local error:

14.4b
(/ x (fma x x 1))

rewrite1.0ms

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

series38.0ms

Counts
1 → 3
Calls
1 calls:
Slowest
38.0ms
(/ x (fma x x 1))

simplify119.0ms

Counts
6 → 18
Calls
6 calls:
Slowest
43.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
41.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
25.0ms
(- (+ x (pow x 5)) (pow x 3))
4.0ms
(cbrt (fma x x 1))
4.0ms
(sqrt (fma x x 1))

prune116.0ms

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0b

localize15.0ms

Local error

Found 4 expressions with local error:

14.4b
(sqrt (fma x x 1))
14.4b
(sqrt (fma x x 1))
0.0b
(/ (/ x (sqrt (fma x x 1))) (sqrt (fma x x 1)))
0.0b
(/ x (sqrt (fma x x 1)))

rewrite16.0ms

Algorithm
rewrite-expression-head
Rules
27×add-sqr-sqrt
25×add-cube-cbrt
25×*-un-lft-identity
24×sqrt-prod
24×times-frac
12×associate-/r*
div-inv
add-exp-log
add-cbrt-cube
add-log-exp
associate-/l*
log1p-expm1-u
pow1
expm1-log1p-u
pow1/2
frac-2neg
clear-num
rem-sqrt-square
associate-/l/
div-exp
cbrt-undiv
Counts
4 → 95
Calls
4 calls:
Slowest
9.0ms
(/ (/ x (sqrt (fma x x 1))) (sqrt (fma x x 1)))
2.0ms
(sqrt (fma x x 1))
2.0ms
(sqrt (fma x x 1))
1.0ms
(/ x (sqrt (fma x x 1)))

series128.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
43.0ms
(/ x (sqrt (fma x x 1)))
35.0ms
(/ (/ x (sqrt (fma x x 1))) (sqrt (fma x x 1)))
30.0ms
(sqrt (fma x x 1))
20.0ms
(sqrt (fma x x 1))

simplify2.4s

Counts
84 → 107
Calls
84 calls:
Slowest
231.0ms
(- (* 1/8 (/ 1 (pow x 3))) (+ x (* 1/2 (/ 1 x))))
217.0ms
(/ (* (* (/ x (sqrt (fma x x 1))) (/ x (sqrt (fma x x 1)))) (/ x (sqrt (fma x x 1)))) (* (* (sqrt (fma x x 1)) (sqrt (fma x x 1))) (sqrt (fma x x 1))))
207.0ms
(- (+ x (* 1/2 (/ 1 x))) (* 1/8 (/ 1 (pow x 3))))
180.0ms
(- (* 1/8 (/ 1 (pow x 3))) (+ x (* 1/2 (/ 1 x))))
178.0ms
(- (+ (* 3/8 (/ 1 (pow x 4))) 1) (* 1/2 (/ 1 (pow x 2))))

prune929.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0b

localize37.0ms

Local error

Found 4 expressions with local error:

0.3b
(cbrt (/ x (hypot 1 x)))
0.3b
(cbrt (/ x (hypot 1 x)))
0.3b
(cbrt (/ x (hypot 1 x)))
0.3b
(* (cbrt (/ x (hypot 1 x))) (cbrt (/ x (hypot 1 x))))

rewrite15.0ms

Algorithm
rewrite-expression-head
Rules
20×cbrt-prod
11×add-cube-cbrt
11×*-un-lft-identity
11×add-sqr-sqrt
pow1
associate-*l*
associate-*r*
pow1/3
cbrt-div
add-exp-log
div-inv
add-log-exp
log1p-expm1-u
add-cbrt-cube
expm1-log1p-u
pow-prod-up
pow-prod-down
cbrt-unprod
*-commutative
associate-*r/
prod-exp
associate-*l/
pow-plus
frac-times
pow2
Counts
4 → 80
Calls
4 calls:
Slowest
10.0ms
(* (cbrt (/ x (hypot 1 x))) (cbrt (/ x (hypot 1 x))))
1.0ms
(cbrt (/ x (hypot 1 x)))
1.0ms
(cbrt (/ x (hypot 1 x)))
1.0ms
(cbrt (/ x (hypot 1 x)))

series770.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
212.0ms
(cbrt (/ x (hypot 1 x)))
198.0ms
(* (cbrt (/ x (hypot 1 x))) (cbrt (/ x (hypot 1 x))))
192.0ms
(cbrt (/ x (hypot 1 x)))
168.0ms
(cbrt (/ x (hypot 1 x)))

simplify1.8s

Counts
53 → 92
Calls
53 calls:
Slowest
223.0ms
(- (+ (* 2/9 (/ (pow (cbrt -1) 2) (pow x 4))) (pow (cbrt -1) 2)) (* 1/3 (/ (pow (cbrt -1) 2) (pow x 2))))
212.0ms
(- (+ (cbrt -1) (* 7/72 (/ (cbrt -1) (pow x 4)))) (* 1/6 (/ (cbrt -1) (pow x 2))))
194.0ms
(- (+ (cbrt -1) (* 7/72 (/ (cbrt -1) (pow x 4)))) (* 1/6 (/ (cbrt -1) (pow x 2))))
192.0ms
(- (+ (cbrt -1) (* 7/72 (/ (cbrt -1) (pow x 4)))) (* 1/6 (/ (cbrt -1) (pow x 2))))
177.0ms
(- (+ (* 2/9 (/ 1 (pow x 4))) 1) (* 1/3 (/ 1 (pow x 2))))

prune928.0ms

Pruning

4 alts after pruning (2 fresh and 2 done)

Merged error: 0b

localize5.0ms

Local error

Found 2 expressions with local error:

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

rewrite6.0ms

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

series49.0ms

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

simplify282.0ms

Counts
16 → 40
Calls
16 calls:
Slowest
51.0ms
(- (+ (/ 1 (pow x 2)) (/ 1 (pow x 6))) (/ 1 (pow x 4)))
47.0ms
(- (+ (/ 1 (pow x 2)) (/ 1 (pow x 6))) (/ 1 (pow x 4)))
41.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
40.0ms
(- (+ (/ 1 (pow x 5)) (/ 1 x)) (/ 1 (pow x 3)))
36.0ms
(- (+ x (pow x 5)) (pow x 3))

prune308.0ms

Pruning

4 alts after pruning (1 fresh and 3 done)

Merged error: 0b

regimes43.0ms

Accuracy

0% (0.8b remaining)

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

bsearch2.0ms

end0.0ms

sample803.0ms

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