Opened 4 years ago

Closed 4 years ago

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

Reported by: Owned by: vdelecroix major sage-8.2 symbolics bug rws Ralf Stephan Jeroen Demeyer N/A 821f7d9 821f7d9f3568316bc0b8b1f5619bcef46cd3bfe1

```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.

### 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: https://github.com/pynac/pynac/commit/163a26940a1a07aaea12ff82532a6c3ea4162c91.diff,

### 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:

 ​4d559ee `24418: 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:

 ​a2a47a8 `24418: 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:

 ​821f7d9 `24418: 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.