Average Error: 0.0 → 0.0
Time: 33.5s
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 - (e^{\log_* (1 + \frac{1}{e^{\log \left((\left(2 - \frac{2}{1 + t}\right) \cdot \left(2 - \frac{2}{1 + t}\right) + 2)_*\right)}})} - 1)^*\]

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. Using strategy rm
  4. Applied add-exp-log0.0

    \[\leadsto 1 - \frac{1}{\color{blue}{e^{\log \left((\left(2 - \frac{2}{1 + t}\right) \cdot \left(2 - \frac{2}{1 + t}\right) + 2)_*\right)}}}\]
  5. Using strategy rm
  6. Applied expm1-log1p-u0.0

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

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

Reproduce

herbie shell --seed 2019016 +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: 33.1s)Debug log

sample42.0ms

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

simplify1.1s

Counts
1 → 1
Calls
1 calls:
Slowest
1.1s
(- 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: 0.0b

localize37.0ms

Local error

Found 4 expressions with local error:

3.7b
(- 2 (/ 2 (+ 1 t)))
3.7b
(- 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)

series98.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
36.0ms
(/ 1 (fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2))
32.0ms
(fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2)
15.0ms
(- 2 (/ 2 (+ 1 t)))
14.0ms
(- 2 (/ 2 (+ 1 t)))

simplify5.8s

Counts
16 → 66
Calls
16 calls:
Slowest
959.0ms
(- (+ (* 2 t) (* 2 (pow t 3))) (* 2 (pow t 2)))
853.0ms
(sqrt (fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2))
778.0ms
(- (+ (* 2 t) (* 2 (pow t 3))) (* 2 (pow t 2)))
694.0ms
(fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2)
691.0ms
(cbrt (fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2))

prune579.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0b

localize13.0ms

Local error

Found 4 expressions with local error:

3.7b
(- 2 (/ 2 (+ 1 t)))
3.7b
(- 2 (/ 2 (+ 1 t)))
0.0b
(/ 1 (exp (log (fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2))))
0.0b
(fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2)

rewrite5.0ms

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

series81.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
34.0ms
(/ 1 (exp (log (fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2))))
26.0ms
(fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2)
12.0ms
(- 2 (/ 2 (+ 1 t)))
9.0ms
(- 2 (/ 2 (+ 1 t)))

simplify10.7s

Counts
23 → 73
Calls
23 calls:
Slowest
887.0ms
(exp (log (fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2)))
861.0ms
(- (log (fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2)))
797.0ms
(cbrt (exp (log (fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2))))
749.0ms
(exp (log (cbrt (fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2))))
733.0ms
(sqrt (exp (log (fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2))))

prune768.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0b

localize18.0ms

Local error

Found 4 expressions with local error:

3.7b
(- 2 (/ 2 (+ 1 t)))
3.7b
(- 2 (/ 2 (+ 1 t)))
0.0b
(/ 1 (exp (log (fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2))))
0.0b
(fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2)

rewrite9.0ms

Algorithm
rewrite-expression-head
Rules
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
associate-/r*
pow1
pow-flip
add-log-exp
log1p-expm1-u
add-exp-log
add-cbrt-cube
exp-prod
expm1-log1p-u
exp-sum
log-prod
flip--
flip3--
sub-neg
inv-pow
div-inv
fma-udef
log-pow
frac-2neg
clear-num
rec-exp
Counts
4 → 61
Calls
4 calls:
Slowest
6.0ms
(/ 1 (exp (log (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)

series93.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
43.0ms
(/ 1 (exp (log (fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2))))
20.0ms
(fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2)
15.0ms
(- 2 (/ 2 (+ 1 t)))
15.0ms
(- 2 (/ 2 (+ 1 t)))

simplify10.9s

Counts
23 → 73
Calls
23 calls:
Slowest
881.0ms
(exp (log (fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2)))
869.0ms
(- (cbrt (log (fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2))))
844.0ms
(- (log (fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2)))
816.0ms
(sqrt (exp (log (fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2))))
793.0ms
(exp (log (sqrt (fma (- 2 (/ 2 (+ 1 t))) (- 2 (/ 2 (+ 1 t))) 2))))

prune986.0ms

Pruning

1 alts after pruning (0 fresh and 1 done)

Merged error: 0b

end0.0ms

sample1.9s

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