1 | | ~~As to a unification, the coefficients could be viewed as a sequence generated by a rational ordinary generating function p(x)/q(x) (C-finite sequence, see #15714) where:~~ |

2 | | ~~* q(x)=1 for rational contfracs (=finite sequence)~~ |

3 | | ~~* q(x)=1-x^d^ with d the contfrac period for quad. irrationals (=infinite sequence)~~ |

4 | | ~~* other p/q, e.g. (2+x+2x^2^-3x^3^-x^4^+x^6^)/(1-2x^3^+x^6^) for e. Of course, absent a theory these must be guessed but that code exists already.~~ |

5 | | ~~* would make e+sqrt(2) exact~~ |

6 | | |

7 | | ~~Arithmetic with p/q is obvious, only back-conversion to non-rational looks impossible at the moment to me.~~ |