# HG changeset patch
# User Eviatar Bach <eviatarbach@gmail.com>
# Date 1377704692 25200
# Node ID 9ff104ad323f37114ba2cbd866ec9ab2b5613996
# Parent cee69e758af138e94a8b672a79f4e7724092285e
Trac #15118: ZeroDivisionError in MPF_pow not propagated in Cython mpmath
diff git a/sage/libs/mpmath/ext_impl.pxd b/sage/libs/mpmath/ext_impl.pxd
a

b


60  60  cdef MPF_cos(MPF *c, MPF *x, MPopts opts) 
61  61  cdef MPF_sin(MPF *c, MPF *x, MPopts opts) 
62  62  cdef MPF_cos_sin(MPF *c, MPF *s, MPF *x, MPopts opts) 
63   cdef int MPF_pow(MPF *z, MPF *x, MPF *y, MPopts opts) 
 63  cdef int MPF_pow(MPF *z, MPF *x, MPF *y, MPopts opts) except 1 
64  64  cdef MPF_complex_pow(MPF *zre, MPF *zim, MPF *xre, MPF *xim, MPF *yre, MPF *yim, MPopts opts) 
65  65  cdef MPF_hypsum(MPF *a, MPF *b, int p, int q, param_types, str ztype, coeffs, \ 
66  66  z, long prec, long wp, long epsshift, dict magnitude_check, kwargs) 
diff git a/sage/libs/mpmath/ext_impl.pyx b/sage/libs/mpmath/ext_impl.pyx
a

b


1  1  """ 
2  2  This module provides the core implementation of multiprecision 
3  3  floatingpoint arithmetic. Operations are done inplace. 
 4  
 5  TESTS: 
 6  
 7  See if :trac:`15118` is fixed:: 
 8  
 9  sage: import mpmath 
 10  sage: mpmath.mpf(0)^(2) 
 11  Traceback (most recent call last): 
 12  ... 
 13  ZeroDivisionError 
 14  sage: mpmath.zeta(2r, 3r) 
 15  Traceback (most recent call last): 
 16  ... 
 17  ZeroDivisionError 
4  18  """ 
5  19  
6  20  include 'sage/ext/interrupt.pxi' 
… 
… 

1646  1660  MPF_clear(&c) 
1647  1661  MPF_clear(&s) 
1648  1662  
1649   cdef int MPF_pow(MPF *z, MPF *x, MPF *y, MPopts opts): 
 1663  cdef int MPF_pow(MPF *z, MPF *x, MPF *y, MPopts opts) except 1: 
1650  1664  """ 
1651  1665  Set z = x^y for real x and y and returns 0 if the result is realvalued. 
1652  1666  If the result is complex, does nothing and returns 1. 