(s, rnd=None)
Convert a raw mpf to the nearest int. Rounding is done down by
    default (same as int(float) in Python), but can be changed. If the
    input is inf/nan, an exception is raised.
Convert a raw mpf to the nearest int. Rounding is done down by
    default (same as int(float) in Python), but can be changed. If the
    input is inf/nan, an exception is raised.
Convert a raw mpf to the nearest int . Rounding is done down by default ( same as int ( float ) in Python ) but can be changed . If the input is inf / nan an exception is raised .
def to_int(s, rnd=None):
    """Convert a raw mpf to the nearest int. Rounding is done down by
    default (same as int(float) in Python), but can be changed. If the
    input is inf/nan, an exception is raised."""
    sign, man, exp, bc = s
    if (not man) and exp:
        raise ValueError("cannot convert %s to int" % man)
    if exp >= 0:
        if sign:
            return (-man) << exp
        return man << exp
    # Make default rounding fast
    if not rnd:
        if sign:
            return -(man >> (-exp))
        else:
            return man >> (-exp)
    if sign:
        return round_int(-man, -exp, rnd)
    else:
        return round_int(man, -exp, rnd)
def to_int ( s , rnd = None ) : sign , man , exp , bc = s if ( not man ) and exp : raise ValueError ( "cannot convert %s to int" % man ) if exp >= 0 : if sign : return ( - man ) << exp return man << exp # Make default rounding fast if not rnd : if sign : return - ( man >> ( - exp ) ) else : return man >> ( - exp ) if sign : return round_int ( - man , - exp , rnd ) else : return round_int ( man , - exp , rnd )