(self, prec)
return res
Careful! any evalf of polar numbers is flaky
Careful! any evalf of polar numbers is flaky
Careful! any evalf of polar numbers is flaky
def _eval_evalf(self, prec):
        """ Careful! any evalf of polar numbers is flaky """
        from sympy import im, pi, re
        i = im(self.args[0])
        if i <= -pi or i > pi:
            return self  # cannot evalf for this argument
        res = exp(self.args[0])._eval_evalf(prec)
        if i > 0 and im(res) < 0:
            # i ~ pi, but exp(I*i) evaluated to argument slightly bigger than pi
            return re(res)
        return res
def _eval_evalf ( self , prec ) : from sympy import im , pi , re i = im ( self . args [ 0 ] ) if i <= - pi or i > pi : return self # cannot evalf for this argument res = exp ( self . args [ 0 ] ) . _eval_evalf ( prec ) if i > 0 and im ( res ) < 0 : # i ~ pi, but exp(I*i) evaluated to argument slightly bigger than pi return re ( res ) return res