Opened 9 years ago

Last modified 5 years ago

#13039 new defect

improve mpmath-to-sage conversion — at Initial Version

Reported by: dsm Owned by: jason, jkantor
Priority: major Milestone: sage-7.4
Component: numerical Keywords: sd40.5
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

Conversions between mpmath and sage objects don't always go smoothly when the number of digits required for the exponent is very large. This can cause problems for limiting behaviour when mpmath is used as the numerical backend for various special functions. For example:

sage: mpmath_utils.call(mpmath.airyai, 1e2)
2.63448215208818e-291
sage: mpmath_utils.call(mpmath.airyai, 1e4)
6.24874575695894e-289532
sage: mpmath_utils.call(mpmath.airyai, 1e8)
0.000000000000000
sage: mpmath_utils.call(mpmath.airyai, 1e16)
---------------------------------------------------------------------------
OverflowError                             Traceback (most recent call last)

/Users/mcneil/sagedev/sage-5.1.beta0/devel/sage-hack/sage/<ipython console> in <module>()

/Users/mcneil/sagedev/sage-5.1.beta0/local/lib/python2.7/site-packages/sage/libs/mpmath/utils.so in sage.libs.mpmath.utils.call (sage/libs/mpmath/utils.c:5667)()

/Users/mcneil/sagedev/sage-5.1.beta0/local/lib/python2.7/site-packages/sage/libs/mpmath/utils.so in sage.libs.mpmath.utils.mpmath_to_sage (sage/libs/mpmath/utils.c:4420)()

/Users/mcneil/sagedev/sage-5.1.beta0/local/lib/python2.7/site-packages/sage/libs/mpmath/utils.so in sage.libs.mpmath.utils.mpfr_from_mpfval (sage/libs/mpmath/utils.c:3701)()

OverflowError: Python int too large to convert to C long

This should probably return zero instead (and similarly go to an inf in the other case).

Change History (0)

Note: See TracTickets for help on using tickets.