Changes between Initial Version and Version 1 of Ticket #5759
- Timestamp:
- Apr 11, 2009, 10:10:28 PM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #5759
-
Property
Priority
changed from
minor
tomajor
-
Property
Priority
changed from
-
Ticket #5759 – Description
initial v1 1 {{{ 2 sage: Zmod(2)(0).divides(Zmod(2)(1)) 3 --------------------------------------------------------------------------- 4 ZeroDivisionError Traceback (most recent call last) 1 The function "divides" does not work for generic commutative rings. 5 2 6 /Users/wstein/.sage/temp/teragon.local/50691/_Users_wstein__sage_init_sage_0.py in <module>() 3 1. it is not checked that the elements are in the same space, i.e. 7 4 8 /Users/wstein/build/sage-3.4.1.rc2/local/lib/python2.5/site-packages/sage/structure/element.so in sage.structure.element.CommutativeRingElement.divides (sage/structure/element.c:12423)() 5 Zmod(5)(1).divides(Zmod(2)(1)) is "True" 9 6 10 /Users/wstein/build/sage-3.4.1.rc2/local/lib/python2.5/site-packages/sage/rings/integer_mod.so in sage.rings.integer_mod.IntegerMod_int.__mod__ (sage/rings/integer_mod.c:17834)() 11 1867 def __mod__(IntegerMod_int self, right): 12 1868 right = int(right) 13 -> 1869 if self.__modulus.int32 % right != 0: 14 1870 raise ZeroDivisionError, "reduction modulo right not defined." 15 1871 return integer_mod_ring.IntegerModRing(right)(self) 7 2. No division by zero checking is done! This gives for example an error if you type 16 8 17 Z eroDivisionError: integer division or modulo by zero9 Zmod(2).zero_ideal() == Zmod(2).zero_ideal() Zmod(2).zero_ideal() == Zmod(2).unit_ideal() 18 10 19 Found by kilian__ on irc. 20 }}} 11 This patch should fix this.