bug? in constant_coerce

8 views
Skip to first unread message

Qian Yun

unread,
Apr 22, 2026, 5:40:32 AMApr 22
to fricas-devel
constant_coerce([x, m, e], m') ==
m' = $SingleInteger =>
if x = ["0"] then x = 0
if x = ["1"] then x = 1
not(INTEGERP(x)) => nil
-- Check if in range of FIXNUM on all supported implementations
x > 8000000 or x < -8000000 => nil
m = $Integer or m = $PositiveInteger or m = $NonNegativeInteger =>
[x, m', e]
nil



The "x = 0" and "x = 1" is compare, not assignment.

Looks like a bug to me. But I lack the expertise to construct
an example to verify this.

- Qian

Waldek Hebisch

unread,
Apr 25, 2026, 1:34:08 PMApr 25
to fricas...@googlegroups.com
Yes, the intent was to assign. AFAICS this does not matter during
algebra build. Quite possible that 0 and 1 are handled earlier or
never get there because they have correct type. Still, I think
we should do assignments above.
--
Waldek Hebisch

Qian Yun

unread,
Apr 25, 2026, 6:15:18 PMApr 25
to fricas...@googlegroups.com
On 4/26/26 1:34 AM, Waldek Hebisch wrote:
>
> Yes, the intent was to assign. AFAICS this does not matter during
> algebra build. Quite possible that 0 and 1 are handled earlier or
> never get there because they have correct type. Still, I think
> we should do assignments above.

Yes, even replace the comparison with error, the build succeeds.
I'll correct it to assignments.

- Qian

Reply all
Reply to author
Forward
0 new messages