Opened 4 years ago

Closed 4 years ago

#24418 closed defect (fixed)

Doctest: bug numerical_approx(2^(450232897/4888643760))

Reported by: vdelecroix Owned by:
Priority: major Milestone: sage-8.2
Component: symbolics Keywords: bug
Cc: rws Merged in:
Authors: Ralf Stephan Reviewers: Jeroen Demeyer
Report Upstream: N/A Work issues:
Branch: 821f7d9 (Commits, GitHub, GitLab) Commit: 821f7d9f3568316bc0b8b1f5619bcef46cd3bfe1
Dependencies: Stopgaps:

Status badges

Description (last modified by vdelecroix)

sage: numerical_approx(2^(450232897/4888643760))
RuntimeError                              Traceback (most recent call last)
<ipython-input-2-3c4e30ac02c1> in <module>()
----> 1 numerical_approx(Integer(2)**(Integer(450232897)/Integer(4888643760)))

/opt/sage/local/lib/python2.7/site-packages/sage/misc/functional.pyc in numerical_approx(x, prec, digits, algorithm)
   1406         return numerical_approx_generic(x, prec)
   1407     else:
-> 1408         return n(prec, algorithm=algorithm)
   1410 n = numerical_approx

/opt/sage/src/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression.numerical_approx (build/cythonized/sage/symbolic/expression.cpp:36040)()
   5814         s = DefiniteSumExpander(self)
-> 5815         cdef Expression x = self._parent(s())
   5816         from sage.rings.real_mpfr import RealField
   5817         R = RealField(prec)

/opt/sage/local/lib/python2.7/site-packages/sage/symbolic/expression_conversions.pyc in __call__(self, ex)
    216                 div = self.get_fake_div(ex)
    217                 return self.arithmetic(div, div.operato
--> 218             return self.arithmetic(ex, operator)
    219         elif operator in relation_operators:
    220             return self.relation(ex, operator)

/opt/sage/local/lib/python2.7/site-packages/sage/symbolic/expretic(self, ex, operator)
   1931             True
   1932         """
-> 1933         return reduce(operator, map(self, ex.operands()
   1935     def composition(self, ex, operator):

/opt/sage/src/sage/symbolic/expression.pyx in sage.symbolic.expd/cythonized/sage/symbolic/expression.cpp:26528)()
   3962                                relational_operator(base
   3963             else:
-> 3964                 x = g_pow(base._gobj, nexp._gobj)
   3965             return new_Expression_from_GEx(base._parent
   3966         if BOTH_ARE_ELEMENT(cl):


The following works

sage: 2^(450232897/4888643760)
sage: 2.0^(450232897/4888643760)

Original report on sage-devel.

Change History (12)

comment:1 Changed 4 years ago by vdelecroix

  • Description modified (diff)

comment:2 Changed 4 years ago by rws

Wrong usage of MPZ size query functions in Pynac. Fixed in 0.7.15. If you cannot wait apply this patch:,

comment:3 Changed 4 years ago by rws

  • Report Upstream changed from N/A to Fixed upstream, in a later stable release.

comment:4 Changed 4 years ago by rws

  • Branch set to u/rws/bug_numerical_approx_2__450232897_4888643760__

comment:5 Changed 4 years ago by rws

  • Authors set to Ralf Stephan
  • Commit set to 4d559ee326f1a93bfb6049326dff05512db60399
  • Report Upstream changed from Fixed upstream, in a later stable release. to N/A
  • Summary changed from bug numerical_approx(2^(450232897/4888643760)) to Doctest: bug numerical_approx(2^(450232897/4888643760))

New commits:

4d559ee24418: Doctest

comment:6 Changed 4 years ago by rws

  • Status changed from new to needs_review

comment:7 Changed 4 years ago by jdemeyer

  • Reviewers set to Jeroen Demeyer
  • Status changed from needs_review to positive_review

comment:8 Changed 4 years ago by git

  • Commit changed from 4d559ee326f1a93bfb6049326dff05512db60399 to a2a47a80edb681e64c623e4a4420c7ac7fb4c1d1
  • Status changed from positive_review to needs_review

Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. New commits:

a2a47a824418: fixes

comment:9 Changed 4 years ago by rws

Ah that was a typo which I couldn't cancel fast enough, sorry.

comment:10 Changed 4 years ago by rws

  • Branch changed from u/rws/bug_numerical_approx_2__450232897_4888643760__ to u/rws/24418-1

comment:11 Changed 4 years ago by rws

  • Commit changed from a2a47a80edb681e64c623e4a4420c7ac7fb4c1d1 to 821f7d9f3568316bc0b8b1f5619bcef46cd3bfe1
  • Status changed from needs_review to positive_review

New commits:

821f7d924418: Doctest

comment:12 Changed 4 years ago by vbraun

  • Branch changed from u/rws/24418-1 to 821f7d9f3568316bc0b8b1f5619bcef46cd3bfe1
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.