Design #1772
Continued fraction: arg type RAT or RAT/INT?
Description
Currently the continued fraction functions expect an arg of type RAT
.
This cause a problem in one program I wrote which had the following structure:
N := AsRAT(...); D := AsRAT(...); CF := ContFrac(N/D);
The problem was that in one instance
N/D
actually turned out to be an integer, so CoCoA-5 automatically gave the value the type INT
.This triggered an error (after several minutes' execution).
Should we allow the continued fraction functions to accept INT
or not?
History
#1 Updated by John Abbott 5 months ago
Possible options:
- disable the auto conversion from
RAT
toINT
-- JAA doubts that this is wise (it could cause many other problems) - extend all the continued fraction functions to accept both
RAT
andINT
-- a bit tedious; also it barely makes sense to ask for the continued fraction of an integer (it's well defined, but fairly pointless) - update the documentation (e.g. with an example like the one which gave me problems, and a solution)
- if we do extend to allow
INT
too, should we also allowRINGELEM
? [we must then convert it toRAT
)