bug: ContinuedFraction is no longer working

3 views
Skip to first unread message

Ralf Hemmecke

unread,
Jun 24, 2026, 12:25:12 PM (2 days ago) Jun 24
to fricas-devel
I just compiled FriCAS f82c476a3dd3e1e1a0311da3271de5715514997d.

Then I get

%%% (13) -> (2/3)::ContinuedFraction(Integer)

Cannot convert the value from type Fraction(Integer) to
ContinuedFraction(Fraction(Integer)) .

%%% (13) -> (2/3)::ContinuedFraction(Integer)

Cannot convert the value from type Fraction(Integer) to
ContinuedFraction(Integer) .

%%% (14) -> 2/(3::ContinuedFraction(Integer))

1 | 1 |
(14) +---+ + +---+
| 1 | 2
Type:
ContinuedFraction(Integer)

And I cannot see why this should happen. Was there a change to
ContinuedFraction that I missed?

FriCAS 1.3.13 still works fine.

Ralf

Waldek Hebisch

unread,
Jun 24, 2026, 1:59:51 PM (2 days ago) Jun 24
to 'Ralf Hemmecke' via FriCAS - computer algebra system
AFAICS ContinuedFraction itself is fine, for example

2::ContinuedFraction(Integer)/3::ContinuedFraction(Integer)

works. The trouble is in the interpreter:

(2) -> coerce((2/3))$ContinuedFraction(Integer)
There are 78 exposed and 131 unexposed library operations named
coerce having 1 argument(s) but none was determined to be
applicable. Use HyperDoc Browse, or issue
)display op coerce
to learn more about the available operations. Perhaps
package-calling the operation or using coercions on the arguments
will allow you to apply the operation.

Cannot find a definition or applicable library operation named
coerce with argument type(s)
Fraction(Integer)

Perhaps you should use "@" to indicate the required return type,
or "$" to specify which version of the function you need.

So, interpreter can no longer find 'coerce'. Looking at list of
operations is see that 'coerce' is there and I expect that calling
it from Spad would work.

Change is due to commit 8093a181ad571732d134ebcbeb711f3c200d237c,

Export Algebra(Fraction(Integer)) only in characteristic 0

We still have:

(2) -> ContinuedFraction(Integer) has Algebra(Fraction(Integer))

(2) true

so the commit is doing nothing wrong. I suspect that trouble is
because operation list has different order. Unfortunatly, there is
an old interpreter bug in search for operations. Due to this bug
interpreter may sometimes miss operations, depending on their
position in operation list.

Fixing this will take some time

--
Waldek Hebisch

Ralf Hemmecke

unread,
Jun 24, 2026, 2:21:14 PM (2 days ago) Jun 24
to fricas...@googlegroups.com
> So, interpreter can no longer find 'coerce'. Looking at list of
> operations is see that 'coerce' is there and I expect that calling
> it from Spad would work.
OK. I was thinking about a way I can (out of the many coerce functions
that ContinuedFraction exports) specify exactly which one I want, i.e.
help the interpreter what to choose, but I cannot come up with a right
combination of $ and @ to make this work. On the other hand it
recognizes that the argument is Fraction(Integer), and
)show also shows that coerce: Fraction(Integer) -> % is there, so it
should know which function to choose. Obviously, the interpreter thinks,
this particular coerce function is not available. Does it use another
search than ")show"?

Ralf

Reply all
Reply to author
Forward
0 new messages