Skip to content

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

Closed
@videlec

Description

@videlec
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)
   1409 
   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)()
   5813 
   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()
   1934 
   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):

RuntimeError: 

The following works

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

Original report on sage-devel.

CC: @rwst

Component: symbolics

Keywords: bug

Author: Ralf Stephan

Branch/Commit: 821f7d9

Reviewer: Jeroen Demeyer

Issue created by migration from https://trac.sagemath.org/ticket/24418

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions