Ticket #3910: trac3910-interval-integers.patch

File trac3910-interval-integers.patch, 24.1 kB (added by cwitty, 5 months ago)
  • a/sage/calculus/calculus.py

    old new  
    48444844            sage: AA(-golden_ratio) 
    48454845            -1.618033988749895? 
    48464846            sage: QQbar((2*I)^(1/2)) 
    4847             1.0000000000000000? + 1.0000000000000000?*I 
     4847            1 + 1*I 
    48484848 
    48494849        TESTS: 
    48504850            sage: AA(x*sin(0)) 
  • a/sage/rings/complex_interval.pyx

    old new  
    407407        EXAMPLES: 
    408408            sage: C.<i> = ComplexIntervalField(20) 
    409409            sage: a = i^2; a 
    410             -1.0000000? 
     410            -1 
    411411            sage: a.parent() 
    412412            Complex Interval Field with 20 bits of precision 
    413413            sage: a = (1+i)^7; a 
    414             8.0000000? - 8.0000000?*I 
     414            8 - 8*I 
    415415            sage: (1+i)^(1+i) 
    416416            0.27396? + 0.58370?*I 
    417417            sage: a.parent() 
     
    450450            sage: i = ComplexIntervalField(100).0 
    451451            sage: z = 2 + 3*i 
    452452            sage: x = z.real(); x 
    453             2.0000000000000000000000000000000? 
     453            2 
    454454            sage: x.parent() 
    455455            Real Interval Field with 100 bits of precision 
    456456        """ 
     
    467467            sage: i = ComplexIntervalField(100).0 
    468468            sage: z = 2 + 3*i 
    469469            sage: x = z.imag(); x 
    470             3.0000000000000000000000000000000? 
     470            3 
    471471            sage: x.parent() 
    472472            Real Interval Field with 100 bits of precision 
    473473        """ 
     
    611611            sage: (RR('-0.001') - i).argument() 
    612612            -1.571796326461564? 
    613613            sage: CIF(2).argument() 
    614             0.?e-17 
     614            0 
    615615            sage: CIF(-2).argument() 
    616616            3.141592653589794? 
    617617 
     
    718718        EXAMPLES: 
    719719            sage: i = CIF.0 
    720720            sage: (1+i).conjugate() 
    721             1.0000000000000000? - 1.0000000000000000?*I 
     721            1 - 1*I 
    722722        """ 
    723723        cdef ComplexIntervalFieldElement x 
    724724        x = self._new() 
     
    874874        sage: ComplexIntervalFieldElement('2.3','1.1') 
    875875        2.300000000000000? + 1.1000000000000000?*I 
    876876        sage: ComplexIntervalFieldElement(10) 
    877         10.000000000000000? 
     877        10 
    878878        sage: ComplexIntervalFieldElement(10,10) 
    879         10.000000000000000? + 10.000000000000000?*I 
     879        10 + 10*I 
    880880        sage: ComplexIntervalFieldElement(1.000000000000000000000000000,2) 
    881         1.00000000000000000000000000000? + 2.00000000000000000000000000000?*I 
     881        1 + 2*I 
    882882        sage: ComplexIntervalFieldElement(1,2.000000000000000000000) 
    883         1.00000000000000000000000? + 2.00000000000000000000000?*I 
     883        1 + 2*I 
     884        sage: ComplexIntervalFieldElement(1.234567890123456789012345, 5.4321098654321987654321) 
     885        1.2345678901234567890123451? + 5.4321098654321987654321000?*I 
    884886    """ 
    885887    if s_imag is None: 
    886888        s_imag = 0 
  • a/sage/rings/complex_interval_field.py

    old new  
    5757        Real Interval Field with 100 bits of precision 
    5858        sage: i = ComplexIntervalField(200).gen() 
    5959        sage: i^2 
    60         -1.0000000000000000000000000000000000000000000000000000000000000? 
     60        -1 
     61        sage: i^i 
     62        0.207879576350761908546955619834978770033877841631769608075136? 
    6163    """ 
    6264    global cache 
    6365    if cache.has_key(prec): 
     
    8183        sage: C(1/3) 
    8284        0.3333333333333334? 
    8385        sage: C(1/3, 2) 
    84         0.3333333333333334? + 2.0000000000000000?*I 
     86        0.3333333333333334? + 2*I 
    8587 
    8688    We can also coerce rational numbers and integers into C, but 
    8789    coercing a polynomial will raise an exception. 
     
    172174        """ 
    173175        EXAMPLES: 
    174176            sage: CIF(2) 
    175             2.0000000000000000? 
     177            2 
    176178            sage: CIF(CIF.0) 
    177             1.0000000000000000?*I 
     179            1*I 
    178180            sage: CIF('1+I') 
    179             1.0000000000000000? + 1.0000000000000000?*I 
     181            1 + 1*I 
    180182            sage: CIF(2,3) 
    181             2.0000000000000000? + 3.0000000000000000?*I 
     183            2 + 3*I 
     184            sage: CIF(pi, e) 
     185            3.141592653589794? + 2.718281828459046?*I 
    182186        """ 
    183187        if im is None: 
    184188            if isinstance(x, complex_interval.ComplexIntervalFieldElement) and x.parent() is self: 
  • a/sage/rings/polynomial/complex_roots.py

    old new  
    4545        sage: x = polygen(ZZ) 
    4646        sage: p = x^9 - 1 
    4747        sage: ip = CIF['x'](p); ip 
    48         1.0000000000000000?*x^9 - 1.0000000000000000? 
     48        x^9 - 1 
    4949        sage: ipd = CIF['x'](p.derivative()); ipd 
    50         9.0000000000000000?*x^8 
     50        9*x^8 
    5151        sage: irt = CIF(CC(cos(2*pi/9), sin(2*pi/9))); irt 
    5252        0.76604444311897802? + 0.64278760968653926?*I 
    5353        sage: ip(irt) 
     
    158158        sage: rts = [CC.zeta(3)^i for i in range(0, 3)] 
    159159        sage: from sage.rings.polynomial.complex_roots import interval_roots 
    160160        sage: interval_roots(p, rts, 53) 
    161         [1.0000000000000000?, -0.500000000000000? + 0.866025403784439?*I, -0.500000000000000? - 0.866025403784439?*I] 
     161        [1, -0.500000000000000? + 0.866025403784439?*I, -0.500000000000000? - 0.866025403784439?*I] 
    162162        sage: interval_roots(p, rts, 200) 
    163         [1.0000000000000000000000000000000000000000000000000000000000000?, -0.500000000000000000000000000000000000000000000000000000000000? + 0.866025403784438646763723170752936183471402626905190314027904?*I, -0.500000000000000000000000000000000000000000000000000000000000? - 0.866025403784438646763723170752936183471402626905190314027904?*I] 
     163        [1, -0.500000000000000000000000000000000000000000000000000000000000? + 0.866025403784438646763723170752936183471402626905190314027904?*I, -0.500000000000000000000000000000000000000000000000000000000000? - 0.866025403784438646763723170752936183471402626905190314027904?*I] 
    164164    """ 
    165165 
    166166    CIF = ComplexIntervalField(prec) 
  • a/sage/rings/polynomial/multi_polynomial_ideal.py

    old new  
    14401440             {y: 1.00000000000000, x: 1.00000000000000}] 
    14411441            sage: I.variety(ring=AA) 
    14421442            [{x: 2.769292354238632?, y: 0.3611030805286474?},  
    1443              {x: 1.0000000000000000?, y: 1.0000000000000000?}] 
     1443             {x: 1, y: 1}] 
    14441444 
    14451445        and a total of four intersections: 
    14461446 
     
    14571457             {x: 0.11535382288068429? - 0.5897428050222055?*I,  
    14581458              y: 0.3194484597356763? + 1.633170240915238?*I},  
    14591459             {x: 2.769292354238632?, y: 0.3611030805286474?},  
    1460              {x: 1.0000000000000000?, y: 1.0000000000000000?}] 
     1460             {x: 1, y: 1}] 
    14611461 
    14621462        TESTS: 
    14631463            sage: K.<w> = GF(27) 
  • a/sage/rings/polynomial/real_roots.pyx

    old new  
    37813781        sage: real_roots(x*(x-1)*(x-2), bounds=(0, 2)) 
    37823782        [((0, 0), 1), ((81/128, 337/256), 1), ((2, 2), 1)] 
    37833783        sage: real_roots(x*(x-1)*(x-2), bounds=(0, 2), retval='algebraic_real') 
    3784         [(0.?e-17, 1), (1.0000000000000000?, 1), (2.0000000000000000?, 1)] 
     3784        [(0, 1), (1, 1), (2, 1)] 
    37853785        sage: v = 2^40 
    37863786        sage: real_roots((x^2-1)^2 * (x^2 - (v+1)/v)) 
    37873787        [((-12855504354077768210885019021174120740504020581912910106032833/12855504354071922204335696738729300820177623950262342682411008, -6427752177038884105442509510587059395588605840418680645585479/6427752177035961102167848369364650410088811975131171341205504), 1), ((-1125899906842725/1125899906842624, -562949953421275/562949953421312), 2), ((62165404551223330269422781018352603934643403586760330761772204409982940218804935733653/62165404551223330269422781018352605012557018849668464680057997111644937126566671941632, 3885337784451458141838923813647037871787041539340705594199885610069035709862106085785/3885337784451458141838923813647037813284813678104279042503624819477808570410416996352), 2), ((509258994083853105745586001837045839749063767798922046787130823804169826426726965449697819/509258994083621521567111422102344540262867098416484062659035112338595324940834176545849344, 25711008708155536421770038042348240136257704305733983563630791/25711008708143844408671393477458601640355247900524685364822016), 1)] 
     
    38083808        sage: real_roots((x+3)*(x+1)*x*(x-1)*(x-2), strategy='warp') 
    38093809        [((-1713/335, -689/335), 1), ((-2067/2029, -689/1359), 1), ((0, 0), 1), ((499/525, 1173/875), 1), ((337/175, 849/175), 1)] 
    38103810        sage: real_roots((x+3)*(x+1)*x*(x-1)*(x-2), strategy='warp', retval='algebraic_real') 
    3811         [(-3.000000000000000?, 1), (-1.000000000000000?, 1), (0.?e-17, 1), (1.000000000000000?, 1), (2.000000000000000?, 1)] 
     3811        [(-3.000000000000000?, 1), (-1.000000000000000?, 1), (0, 1), (1.000000000000000?, 1), (2.000000000000000?, 1)] 
    38123812        sage: ar_rts = real_roots(x-1, retval='algebraic_real') 
    38133813        sage: ar_rts[0][0] == 1 
    38143814        True 
  • a/sage/rings/qqbar.py

    old new  
    130130    sage: AA((-8)^(1/3)) 
    131131    -2 
    132132    sage: QQbar((-4)^(1/4)) 
    133     1.0000000000000000? + 1.0000000000000000?*I 
     133    1 + 1*I 
    134134    sage: AA((-4)^(1/4)) 
    135135    Traceback (most recent call last): 
    136136    ... 
     
    366366    sage: convert_test_all(CC) 
    367367    [42.0000000000000, 3.14285714285714, 1.61803398874989, -13.0000000000000, 1.61818181818182, -2.64575131106459, 0.309016994374947 + 0.951056516295154*I] 
    368368    sage: convert_test_all(RIF) 
    369     [42.000000000000000?, 3.142857142857143?, 1.618033988749895?, -13.000000000000000?, 1.6181818181818183?, -2.645751311064591?, None] 
     369    [42, 3.142857142857143?, 1.618033988749895?, -13, 1.6181818181818183?, -2.645751311064591?, None] 
    370370    sage: convert_test_all(CIF) 
    371     [42.000000000000000?, 3.142857142857143?, 1.618033988749895?, -13.000000000000000?, 1.6181818181818183?, -2.645751311064591?, 0.3090169943749475? + 0.9510565162951536?*I] 
     371    [42, 3.142857142857143?, 1.618033988749895?, -13, 1.6181818181818183?, -2.645751311064591?, 0.3090169943749475? + 0.9510565162951536?*I] 
    372372    sage: convert_test_all(ZZ) 
    373373    [42, None, None, -13, None, None, None] 
    374374    sage: convert_test_all(QQ) 
     
    726726            sage: p = (x-1)^7 * (x-2) 
    727727            sage: r = QQbar.polynomial_root(p, RIF(9/10, 11/10), multiplicity=7) 
    728728            sage: r; r == 1 
    729             1.0000000000000000? 
     729            1 
    730730            True 
    731731            sage: p = (x-phi)*(x-sqrt(QQbar(2))) 
    732732            sage: r = QQbar.polynomial_root(p, RIF(1, 3/2)) 
     
    12531253        sage: nf = NumberField(y^2 + 1, name='a', check=False) 
    12541254        sage: root = ANRoot(x^2 + 1, CIF(0, 1)) 
    12551255        sage: x = AlgebraicGenerator(nf, root); x         
    1256         Number Field in a with defining polynomial y^2 + 1 with a in 1.0000000000000000?*I 
     1256        Number Field in a with defining polynomial y^2 + 1 with a in 1*I 
    12571257        """ 
    12581258        self._field = field 
    12591259        self._pari_field = None 
     
    27922792 
    27932793        EXAMPLES: 
    27942794            sage: QQbar(3 + 4*I).conjugate() 
    2795             3.0000000000000000? - 4.0000000000000000?*I 
     2795            3 - 4*I 
    27962796            sage: QQbar.zeta(7).conjugate() 
    27972797            0.6234898018587335? - 0.7818314824680299?*I 
    27982798            sage: QQbar.zeta(7) + QQbar.zeta(7).conjugate() 
     
    28782878            sage: a = QQbar.zeta(9) + I + QQbar.zeta(9).conjugate(); a 
    28792879            1.532088886237957? + 1.000000000000000?*I 
    28802880            sage: a.complex_exact(CIF) 
    2881             1.532088886237957? + 1.0000000000000000?*I 
     2881            1.532088886237957? + 1*I 
    28822882        """ 
    28832883        rfld = field._real_field() 
    28842884        re = self.real().real_exact(rfld) 
     
    32133213            sage: y.interval(RIF) 
    32143214            2.000000000000000? 
    32153215            sage: y.interval_exact(RIF) 
    3216             2.0000000000000000? 
     3216            2 
    32173217            sage: z = 1 + AA(2).sqrt() / 2^200 
    32183218            sage: z.interval(RIF) 
    32193219            1.000000000000001? 
     
    44924492 
    44934493        EXAMPLES: 
    44944494            sage: a = AA(sqrt(2)) + QQbar(I); a 
    4495             1.414213562373095? + 1.0000000000000000?*I 
     4495            1.414213562373095? + 1*I 
    44964496            sage: p = a.minpoly(); p 
    44974497            x^4 - 2*x^2 + 9 
    44984498            sage: p(a) 
  • a/sage/rings/real_mpfi.pyx

    old new  
    3636 
    3737    sage: RIF(sqrt(2)) 
    3838    1.414213562373095? 
     39 
     40However, if the interval is precise (its lower bound is equal to its 
     41upper bound) and equal to a not-too-large integer, then we just print that 
     42integer. 
     43 
     44    sage: RIF(0) 
     45    0 
     46    sage: RIF(654321) 
     47    654321 
     48 
    3949    sage: RIF(123, 125) 
    4050    124.? 
    4151    sage: RIF(123, 126) 
     
    6272Error digits also sometimes let us indicate that the interval is actually 
    6373equal to a single floating-point number. 
    6474 
    65     sage: RIF(124
    66     124.00000000000000? 
    67     sage: RIF(124).str(error_digits=1) 
    68     '124.00000000000000?0' 
     75    sage: RIF(54321/256
     76    212.19140625000000? 
     77    sage: RIF(54321/256).str(error_digits=1) 
     78    '212.19140625000000?0' 
    6979 
    7080In brackets style, intervals are printed with the left value rounded 
    7181down and the right rounded up, which is conservative, but in some ways 
     
    239249        sage: RIF = RealIntervalField(); RIF 
    240250        Real Interval Field with 53 bits of precision 
    241251        sage: RIF(3) 
    242         3.0000000000000000? 
     252        3 
    243253        sage: RIF(RIF(3)) 
    244         3.0000000000000000? 
     254        3 
    245255        sage: RIF(pi) 
    246256        3.141592653589794? 
    247257        sage: RIF(RealField(53)('1.5')) 
     
    249259        sage: RIF(-2/19) 
    250260        -0.10526315789473684? 
    251261        sage: RIF(-3939) 
    252         -3939.0000000000000? 
     262        -3939 
    253263        sage: RIF(-3939r) 
    254         -3939.0000000000000? 
     264        -3939 
    255265        sage: RIF('1.5') 
    256266        1.5000000000000000? 
    257267        sage: RIF(RQDF.pi()) 
     
    262272 
    263273    The base must be explicitly specified as a named parameter: 
    264274        sage: RIF('101101', base=2) 
    265         45.000000000000000? 
     275        45 
    266276        sage: RIF('+infinity') 
    267277        [+infinity .. +infinity] 
    268278        sage: RIF('[1..3]').str(style='brackets') 
     
    323333    Some examples with a real interval field of higher precision: 
    324334        sage: R = RealIntervalField(100) 
    325335        sage: R(3) 
    326         3.0000000000000000000000000000000? 
     336        3 
    327337        sage: R(R(3)) 
    328         3.0000000000000000000000000000000? 
     338        3 
    329339        sage: R(pi) 
    330340        3.14159265358979323846264338328? 
    331341        sage: R(-2/19) 
     
    676686        EXAMPLES: 
    677687            sage: R = RealIntervalField() 
    678688            sage: R.zeta() 
    679             -1.0000000000000000? 
     689            -1 
    680690            sage: R.zeta(1) 
    681             1.0000000000000000? 
     691            1 
    682692            sage: R.zeta(5) 
    683693            Traceback (most recent call last): 
    684694            ... 
     
    950960        sage: RIF(pi, 22/7).str(style='question') 
    951961        '3.142?' 
    952962 
     963        However, if the interval is precisely equal to some integer that's 
     964        not too large, we just return that integer. 
     965 
     966        sage: RIF(-42).str() 
     967        '-42' 
     968        sage: RIF(0).str() 
     969        '0' 
     970        sage: RIF(12^5).str(base=3) 
     971        '110122100000' 
     972 
     973        Very large integers, however, revert to the normal question-style 
     974        printing. 
     975 
     976        sage: RIF(3^7).str() 
     977        '2187' 
     978        sage: RIF(3^7 * 2^256).str() 
     979        '2.5323729916201052?e80' 
     980 
    953981        In brackets style, we print the lower and upper bounds of the 
    954982        interval within brackets: 
    955983 
     
    10641092            1.732050807568878? 
    10651093            sage: RIF(3).sqrt() 
    10661094            1.732050807568878? 
     1095            sage: RIF(0, 3^-150) 
     1096            1.?e-71 
    10671097        """ 
    10681098        if base < 2 or base > 36: 
    10691099            raise ValueError, "the base (=%s) must be between 2 and 36"%base 
     
    12201250            14142.13562373095? 
    12211251            141421.3562373095? 
    12221252            1.414213562373095?e6 
     1253            sage: RIF(3^33) 
     1254            5559060566555523 
     1255            sage: RIF(3^33 * 2) 
     1256            1.1118121133111046?e16 
     1257            sage: RIF(-pi^-512, 0) 
     1258            -1.?e-254 
     1259            sage: RealIntervalField(2)(3 * 2^18) 
     1260            786432 
     1261            sage: RealIntervalField(2)(3 * 2^19) 
     1262            1.6?e6 
    12231263        """ 
    12241264        if not(mpfr_number_p(&self.value.left) and mpfr_number_p(&self.value.right)): 
    12251265            raise ValueError, "_str_question_style on NaN or infinity" 
     
    12371277            # error digits; 1000 error digits is just silly. 
    12381278            raise ValueError, "error_digits (=%s) must be between 0 and 1000"%error_digits 
    12391279             
     1280        cdef mp_exp_t self_exp 
     1281        cdef mpz_t self_zz 
     1282        cdef int prec = (<RealIntervalField>self._parent).__prec 
     1283        cdef char *zz_str 
     1284        cdef size_t zz_str_maxlen 
     1285         
     1286        if mpfr_equal_p(&self.value.left, &self.value.right) \ 
     1287                and mpfr_integer_p(&self.value.left): 
     1288            # This might be suitable for integer printing, but not if it's 
     1289            # too big.  (We can represent 2^3000000 exactly in RIF, but we 
     1290            # don't want to print this 903090 digit number; we'd rather 
     1291            # just print 9.7049196389007116?e903089 .) 
     1292 
     1293            # Represent self as m*2^k, where m is an integer with 
     1294            # self.prec() bits and k is an integer.  (So RIF(1) would have 
     1295            # m = 2^52 and k=-52.)  Then, as a simple heuristic, we print 
     1296            # as an integer if k<=0.  (As a special dispensation for tiny 
     1297            # precisions, we also print as an integer if the number is 
     1298            # less than a million (actually, less than 2^20); this  
     1299            # will never affect "normal" uses, but it makes tiny examples 
     1300            # with RealIntervalField(2) prettier.) 
     1301 
     1302            self_exp = mpfr_get_exp(&self.value.left) 
     1303            if mpfr_zero_p(&self.value.left) or self_exp <= prec or self_exp <= 20: 
     1304                mpz_init(self_zz) 
     1305                mpfr_get_z(self_zz, &self.value.left, GMP_RNDN) 
     1306                zz_str_maxlen = mpz_sizeinbase(self_zz, base) + 2 
     1307                zz_str = <char *>PyMem_Malloc(zz_str_maxlen) 
     1308                if zz_str == NULL: 
     1309                    mpz_clear(self_zz) 
     1310                    raise MemoryError, "Unable to allocate memory for integer representation of interval" 
     1311                _sig_on 
     1312                mpz_get_str(zz_str, base, self_zz) 
     1313                _sig_off 
     1314                v = PyString_FromString(zz_str) 
     1315                PyMem_Free(zz_str) 
     1316                return v 
     1317 
    12401318        # We want the endpoints represented as an integer mantissa 
    12411319        # and an exponent, using the given base.  MPFR will do that for 
    12421320        # us in mpfr_get_str, so we end up converting from MPFR to strings 
     
    13081386        # exponents are sufficiently different, the simple code would 
    13091387        # involve computing a huge power of base, and then dividing 
    13101388        # by it to get -1, 0, or 1 (depending on the rounding). 
     1389 
     1390        # There's one complication first: if one of the endpoints is zero, 
     1391        # we want to treat it as infinitely precise (otherwise, it defaults 
     1392        # to a precision of 2^-self.prec(), so that RIF(0, 2^-1000) 
     1393        # would print as 1.?e-17).  (If both endpoints are zero, then 
     1394        # we can't get here; we already returned '0' in the integer 
     1395        # case above.) 
     1396 
     1397        if mpfr_zero_p(&self.value.left): 
     1398            lower_expo = upper_expo 
     1399        if mpfr_zero_p(&self.value.right): 
     1400            upper_expo = lower_expo 
    13111401 
    13121402        cdef int expo_delta 
    13131403 
     
    17841874        EXAMPLES: 
    17851875            sage: R = RealIntervalField() 
    17861876            sage: R(-1.5) + R(2.5) 
    1787             1.0000000000000000? 
     1877            1 
    17881878            sage: R('-1.3') + R('2.3') 
    17891879            1.000000000000000? 
    17901880            sage: (R(1, 2) + R(3, 4)).str(style='brackets') 
     
    18031893 
    18041894        EXAMPLES: 
    18051895            sage: v = RIF(2); v 
    1806             2.0000000000000000? 
     1896            2 
    18071897            sage: ~v 
    18081898            0.50000000000000000? 
    18091899            sage: v * ~v 
    1810             1.0000000000000000? 
     1900            1 
    18111901            sage: v = RIF(1.5, 2.5); v.str(style='brackets') 
    18121902            '[1.5000000000000000 .. 2.5000000000000000]' 
    18131903            sage: (~v).str(style='brackets') 
     
    18291919        EXAMPLES: 
    18301920            sage: R = RealIntervalField() 
    18311921            sage: R(-1.5) - R(2.5) 
    1832             -4.0000000000000000? 
     1922            -4 
    18331923            sage: R('-1.3') - R('2.7') 
    18341924            -4.000000000000000? 
    18351925            sage: (R(1, 2) - R(3, 4)).str(style='brackets') 
     
    19091999 
    19102000        EXAMPLES: 
    19112001            sage: v = RIF(2); v 
    1912             2.0000000000000000? 
     2002            2 
    19132003            sage: -v 
    1914             -2.0000000000000000? 
     2004            -2 
    19152005            sage: v + -v 
    1916             0.?e-17 
     2006            0 
    19172007            sage: v = RIF(1.5, 2.5); v.str(error_digits=3) 
    19182008            '2.000?500' 
    19192009            sage: (-v).str(style='brackets') 
     
    19722062 
    19732063        EXAMPLES: 
    19742064            sage: RIF(1.0) << 32 
    1975             4.2949672960000000?e9 
     2065            4294967296 
    19762066        """ 
    19772067        if isinstance(x, RealIntervalFieldElement) and isinstance(y, (int,long, Integer)): 
    19782068            return x._lshift_(y) 
     
    26882778        EXAMPLES: 
    26892779            sage: r = RIF(4.0) 
    26902780            sage: r.sqrt() 
    2691             2.0000000000000000? 
     2781            2 
    26922782            sage: r.sqrt()^2 == r 
    26932783            True 
    26942784 
     
    27082798            sage: r.sqrt() 
    27092799            Traceback (most recent call last): 
    27102800            ... 
    2711             ValueError: self (=-2.0000000000000000?) is not >= 0 
     2801            ValueError: self (=-2) is not >= 0 
    27122802 
    27132803            sage: r = RIF(-2, 2) 
    27142804            sage: r.sqrt() 
     
    27332823            sage: r.sqrt() 
    27342824            Traceback (most recent call last): 
    27352825            ... 
    2736             ValueError: self (=-2.0000000000000000?) is not >= 0 
     2826            ValueError: self (=-2) is not >= 0 
    27372827        """ 
    27382828        cdef RealIntervalFieldElement x 
    27392829        x = self._new() 
     
    28362926        EXAMPLES: 
    28372927            sage: r = RIF(16.0) 
    28382928            sage: r.log2() 
    2839             4.0000000000000000? 
     2929            4 
    28402930 
    28412931            sage: r = RIF(31.9); r.log2() 
    28422932            4.995484518877507? 
     
    28882978        EXAMPLES: 
    28892979            sage: r = RIF(0.0) 
    28902980            sage: r.exp() 
    2891             1.0000000000000000? 
     2981            1 
    28922982 
    28932983            sage: r = RIF(32.3) 
    28942984            sage: a = r.exp(); a 
     
    29143004        EXAMPLES: 
    29153005            sage: r = RIF(0.0) 
    29163006            sage: r.exp2() 
    2917             1.0000000000000000? 
     3007            1 
    29183008             
    29193009            sage: r = RIF(32.0) 
    29203010            sage: r.exp2() 
    2921             4.2949672960000000?e9 
     3011            4294967296 
    29223012 
    29233013            sage: r = RIF(-32.3) 
    29243014            sage: r.exp2() 
     
    34993589        sage: RealInterval('2.3') 
    35003590        2.300000000000000? 
    35013591        sage: RealInterval(10) 
    3502         10.000000000000000? 
     3592        10 
    35033593        sage: RealInterval('1.0000000000000000000000000000000000') 
    3504         1.000000000000000000000000000000000000? 
     3594        1 
     3595        sage: RealInterval('1.2345678901234567890123456789012345') 
     3596        1.23456789012345678901234567890123450? 
    35053597        sage: RealInterval(29308290382930840239842390482, 3^20).str(style='brackets') 
    35063598        '[3.48678440100000000000000000000e9 .. 2.93082903829308402398423904820e28]' 
    35073599    """