Average Error: 0.0 → 0.0
Time: 8.9s
Precision: 64
Internal Precision: 128
\[1 - \frac{1}{2 + \left(2 - \frac{\frac{2}{t}}{1 + \frac{1}{t}}\right) \cdot \left(2 - \frac{\frac{2}{t}}{1 + \frac{1}{t}}\right)}\]
\[1 - \frac{1}{(\left(2 - \frac{2}{1 + t}\right) \cdot \left(2 - \frac{2}{1 + t}\right) + 2)_*}\]

Error

Bits error versus t

Derivation

  1. Initial program 0.0

    \[1 - \frac{1}{2 + \left(2 - \frac{\frac{2}{t}}{1 + \frac{1}{t}}\right) \cdot \left(2 - \frac{\frac{2}{t}}{1 + \frac{1}{t}}\right)}\]
  2. Simplified0.0

    \[\leadsto \color{blue}{1 - \frac{1}{(\left(2 - \frac{2}{1 + t}\right) \cdot \left(2 - \frac{2}{1 + t}\right) + 2)_*}}\]
  3. Final simplification0.0

    \[\leadsto 1 - \frac{1}{(\left(2 - \frac{2}{1 + t}\right) \cdot \left(2 - \frac{2}{1 + t}\right) + 2)_*}\]

Reproduce

herbie shell --seed 2019022 +o rules:numerics
(FPCore (t)
  :name "Kahan p13 Example 3"
  (- 1 (/ 1 (+ 2 (* (- 2 (/ (/ 2 t) (+ 1 (/ 1 t)))) (- 2 (/ (/ 2 t) (+ 1 (/ 1 t)))))))))

Details

Time bar (total: 8.7s)Debug log

sample96.0ms

Algorithm
intervals
Results
80.0ms256×body80valid

simplify926.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
925.0ms
(- 1 (/ 1 (+ 2 (* (- 2 (/ (/ 2 t) (+ 1 (/ 1 t)))) (- 2 (/ (/ 2 t) (+ 1 (/ 1 t))))))))

prune17.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0b

localize33.0ms

Local error

Found 4 expressions with local error:

3.3b
(- 2 (/ 2 (+ 1 t)))
3.3b
(- 2 (/ 2 (+ 1 t)))
0.0b
(/ 1 (fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2))
0.0b
(fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2)

rewrite4.0ms

Algorithm
rewrite-expression-head
Rules
add-cube-cbrt
add-exp-log
*-un-lft-identity
pow1
add-sqr-sqrt
add-log-exp
log1p-expm1-u
add-cbrt-cube
expm1-log1p-u
associate-/r*
flip--
flip3--
sub-neg
inv-pow
pow-flip
div-inv
fma-udef
frac-2neg
clear-num
rec-exp
Counts
4 → 54
Calls
4 calls:
Slowest
2.0ms
(/ 1 (fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2))
1.0ms
(- 2 (/ 2 (+ 1 t)))
1.0ms
(- 2 (/ 2 (+ 1 t)))
0.0ms
(fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2)

series76.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
29.0ms
(fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2)
25.0ms
(/ 1 (fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2))
14.0ms
(- 2 (/ 2 (+ 1 t)))
9.0ms
(- 2 (/ 2 (+ 1 t)))

simplify5.2s

Counts
16 → 66
Calls
16 calls:
Slowest
796.0ms
(fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2)
748.0ms
(cbrt (fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2))
727.0ms
(- (+ (* 2 t) (* 2 (pow t 3))) (* 2 (pow t 2)))
688.0ms
(sqrt (fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2))
602.0ms
(- (+ (* 2 t) (* 2 (pow t 3))) (* 2 (pow t 2)))

prune498.0ms

Pruning

1 alts after pruning (0 fresh and 1 done)

Merged error: 0b

end0.0ms

sample1.8s

Algorithm
intervals
Results
1.7s8000×body80valid