Ticket #9466: my1.patch

File my1.patch, 829 bytes (added by ruckers, 10 years ago)

Fixes the code: sage: 2.sqrt(extend = False, all = True)

  • sage/rings/integer.pyx

    # HG changeset patch
    # User Math 480 Student
    # Date 1328667604 28800
    # Node ID b0d1f17ebc8f2655146231b4379419a1762791b3
    # Parent  c239be1054e01526a1b0b62da6691061b9dd5587
    Ticket #9466.  Fixed sqrt(all=true) to not raise an error if no root exist, but
    instead to return an empty list.
    
    diff --git a/sage/rings/integer.pyx b/sage/rings/integer.pyx
    a b  
    49394939
    49404940        if non_square:
    49414941            if not extend:
    4942                 raise ValueError, "square root of %s not an integer"%self
     4942                if not all:
     4943                   raise ValueError, "square root of %s not an integer"%self
     4944                else:
     4945                    return []
    49434946            from sage.functions.other import _do_sqrt
    49444947            return _do_sqrt(self, prec=prec, all=all)
    49454948