Feature #1410
IsDivisible also for INT
Status:
Closed
Priority:
High
Assignee:
Category:
enhancing/improving
Target version:
Description
In CoCoALib IsDivisible
works for various types of value, including integers.
In CoCoA-5, it expects just a RINGELEM
.
Extend it to work with INT
too?
History
#1 Updated by John Abbott about 4 years ago
- Status changed from New to In Progress
- % Done changed from 0 to 10
I have been caught out by this myself on several occasions. I know one can use mod
instead, but it is more expressive if one can write IsDivisible(a,b)
.
Florian asked me about it today (over lunch).
It should be easy to implement; should we? Shall we?
#2 Updated by Anna Maria Bigatti about 4 years ago
John Abbott wrote:
I have been caught out by this myself on several occasions. I know one can use
mod
instead, but it is more expressive if one can writeIsDivisible(a,b)
.
I agree.
So, it is just to add all the compbination of types (somehow) for cocoa-5?
#3 Updated by John Abbott about 4 years ago
- % Done changed from 10 to 20
Yes. I think there are probably just two (main) cases:
RINGELEM
andRINGELEM
INT
andINT
- not so sure about
INT
andRINGELEM
(orRINGELEM
andINT
)
#4 Updated by Anna Maria Bigatti about 4 years ago
- Assignee set to Anna Maria Bigatti
done
/**/ use QQ[x]; /**/ IsDivisible(9,3); true /**/ IsDivisible(9,2); false /**/ IsDivisible(9*x,2); -- 9*x is in QQ[x], so divisible by any constant!! true /**/ use ZZ[x]; /**/ IsDivisible(9*x,2); false
#5 Updated by Anna Maria Bigatti about 4 years ago
- Status changed from In Progress to Closed
- % Done changed from 20 to 100
- Estimated time set to 2.01 h
manual done