This may happen on the first request due to CSS mimetype issues. Try clearing your browser cache and refreshing.

cf is grossly wrong for composed expressions. For example:

cf(sqrt(2)*sqrt(3)), cflength=3 => [2,2,4,1,5,1,1,3]

cf(sqrt(6)), cflength=3 => [2,2,4,2,4,2,4]

^^

This is because it first calculates the truncated cf of the parts, and multiplies them. There is no way a priori of knowing which terms in the result are correct. There also seem to be some egregious bugs (which aren't worth fixing because of the above general problem):

expr: sqrt(3)-sqrt(2)$

float(expr) => 0.318...

cf(expr),cflength=5 => [3, 6, 1, 5, 7, ...

cf(float(expr)) => [0,3,6,1,5...]

float(cfdisrep(cf(expr))), cflength=5 => 3.146...

float(cfdisrep(cf(expr))), cflength=100 => 3.146...

I do not see the usefulness of calculating cf(sqrt(2)*sqrt(3)) as cf(sqrt(2))*cf(sqrt(3)), but perhaps someone else does. I also don't see the usefulness of the cflength parameter as currently defined.

More examples where current code is wrong (and also produces lots of spurious extra terms):

cf(sqrt(2/3)),cflength:12 =>

[0,1,4,2,4,2,4,2,4,2,3,1,281,4,2,1,9,1,3,2,2,14]

^^^ first incorrect term @ position 11

(would be correct if rounded to 11 terms, but not to 12)

(With Andreas Eder's new code):

cf((3/5)^(1/3)),cflength:5 =>

[0, 1, 5, 3, 2, 2, 2]

^^^ first incorrect term @ position 4

cf(100000^(1/3)),cflength:5 == cflength(10*100^(1/3)) =>

[46,2,2,2,8,1,1 ...]

^ first incorrect term @ 3