(value, prec)
return re, im, re_acc, im_acc
Chop off tiny real or complex parts.
Chop off tiny real or complex parts.
Chop off tiny real or complex parts .
def chop_parts(value, prec):
    """
    Chop off tiny real or complex parts.
    """
    re, im, re_acc, im_acc = value
    # Method 1: chop based on absolute value
    if re and re not in _infs_nan and (fastlog(re) < -prec + 4):
        re, re_acc = None, None
    if im and im not in _infs_nan and (fastlog(im) < -prec + 4):
        im, im_acc = None, None
    # Method 2: chop if inaccurate and relatively small
    if re and im:
        delta = fastlog(re) - fastlog(im)
        if re_acc < 2 and (delta - re_acc <= -prec + 4):
            re, re_acc = None, None
        if im_acc < 2 and (delta - im_acc >= prec - 4):
            im, im_acc = None, None
    return re, im, re_acc, im_acc
def chop_parts ( value , prec ) : re , im , re_acc , im_acc = value # Method 1: chop based on absolute value if re and re not in _infs_nan and ( fastlog ( re ) < - prec + 4 ) : re , re_acc = None , None if im and im not in _infs_nan and ( fastlog ( im ) < - prec + 4 ) : im , im_acc = None , None # Method 2: chop if inaccurate and relatively small if re and im : delta = fastlog ( re ) - fastlog ( im ) if re_acc < 2 and ( delta - re_acc <= - prec + 4 ) : re , re_acc = None , None if im_acc < 2 and ( delta - im_acc >= prec - 4 ) : im , im_acc = None , None return re , im , re_acc , im_acc