Changes between Initial Version and Version 1 of Ticket #5759


Ignore:
Timestamp:
Apr 11, 2009, 10:10:28 PM (14 years ago)
Author:
kkilger
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #5759

    • Property Priority changed from minor to major
  • Ticket #5759 – Description

    initial v1  
    1 {{{
    2 sage: Zmod(2)(0).divides(Zmod(2)(1))
    3 ---------------------------------------------------------------------------
    4 ZeroDivisionError                         Traceback (most recent call last)
     1The function "divides" does not work for generic commutative rings.
    52
    6 /Users/wstein/.sage/temp/teragon.local/50691/_Users_wstein__sage_init_sage_0.py in <module>()
     31. it is not checked that the elements are in the same space, i.e.
    74
    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)()
     5Zmod(5)(1).divides(Zmod(2)(1)) is "True"
    96
    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)
     72. No division by zero checking is done! This gives for example an error if you type
    168
    17 ZeroDivisionError: integer division or modulo by zero
     9Zmod(2).zero_ideal() == Zmod(2).zero_ideal() Zmod(2).zero_ideal() == Zmod(2).unit_ideal()
    1810
    19 Found by  kilian__ on irc.
    20 }}}
     11This patch should fix this.