Ticket #12480: 12480.patch

File 12480.patch, 1.9 KB (added by roed, 9 years ago)
  • sage/rings/padics/padic_ZZ_pX_CR_element.pyx

    # HG changeset patch
    # User David Roe <roed@math.harvard.edu>
    # Date 1328830307 28800
    # Node ID eab6a96c109744952b8fbff20c31317e93780395
    # Parent  8a949887e36294a37d8713298a7dd2eeaf25659e
    #12480: Fix padics bug appearing in OS X 10.7
    
    diff --git a/sage/rings/padics/padic_ZZ_pX_CR_element.pyx b/sage/rings/padics/padic_ZZ_pX_CR_element.pyx
    a b  
    631631            sage: F = W.fraction_field()
    632632            sage: z = F(1+w); z # indirect doctest
    633633            1 + w + O(w^1530)
     634            sage: z = F(w+w^2,relprec=0); z
     635            O(w)
    634636        """
    635637        self.ordp = ordp
    636638        self._set_prec_rel(relprec)
     
    920922        # the -1 in the next line signals that there is no absprec specified
    921923        self._set_from_ZZX_part1(poly, -1, relprec)
    922924        # context was restored in _set_from_ZZX_part1
     925        if relprec == 0:
     926            self._set_prec_rel(relprec)
     927            return 0
    923928        if self.relprec + self.ordp != 0:
    924929            self.prime_pow.restore_context_capdiv(self.relprec + self.ordp)
    925930            ZZX_to_ZZ_pX(self.unit, poly)
     
    10361041                self._set_inexact_zero(ctx_prec)
    10371042            return 0
    10381043        self._set_from_ZZ_pX_part1(poly)
     1044        if relprec == 0:
     1045            self._set_prec_rel(relprec)
     1046            return 0
    10391047        if ctx_prec == -1:
    10401048            self._set_prec_rel(self.ordp + relprec)
    10411049        else:
     
    12961304            sage: y # indirect doctest
    12971305            w^5 + w^6 + 2*w^7 + 4*w^8 + 3*w^10 + w^12 + 4*w^13 + 4*w^14 + 4*w^15 + 4*w^16 + 4*w^17 + 4*w^20 + w^21 + 4*w^24 + O(w^25)       
    12981306        """
     1307        if self.relprec == 0:
     1308            raise RuntimeError("p-adic Internal l-shift called with relative precision 0")
    12991309        cdef ZZ_pX_c tmpP
    13001310        cdef ZZ_pX_Modulus_c* mod
    13011311        if self.prime_pow.e == 1: