(cls, val=fzero, **kwargs)
A new mpf can be created from a Python float, an int, a
        or a decimal string representing a number in floating-point
        format.
A new mpf can be created from a Python float, an int, a
        or a decimal string representing a number in floating-point
        format.
A new mpf can be created from a Python float an int a or a decimal string representing a number in floating - point format .
def __new__(cls, val=fzero, **kwargs):
        """A new mpf can be created from a Python float, an int, a
        or a decimal string representing a number in floating-point
        format."""
        prec, rounding = cls.context._prec_rounding
        if kwargs:
            prec = kwargs.get('prec', prec)
            if 'dps' in kwargs:
                prec = dps_to_prec(kwargs['dps'])
            rounding = kwargs.get('rounding', rounding)
        if type(val) is cls:
            sign, man, exp, bc = val._mpf_
            if (not man) and exp:
                return val
            v = new(cls)
            v._mpf_ = normalize(sign, man, exp, bc, prec, rounding)
            return v
        elif type(val) is tuple:
            if len(val) == 2:
                v = new(cls)
                v._mpf_ = from_man_exp(val[0], val[1], prec, rounding)
                return v
            if len(val) == 4:
                sign, man, exp, bc = val
                v = new(cls)
                v._mpf_ = normalize(sign, MPZ(man), exp, bc, prec, rounding)
                return v
            raise ValueError
        else:
            v = new(cls)
            v._mpf_ = mpf_pos(cls.mpf_convert_arg(val, prec, rounding), prec, rounding)
            return v
def __new__ ( cls , val = fzero , * * kwargs ) : prec , rounding = cls . context . _prec_rounding if kwargs : prec = kwargs . get ( 'prec' , prec ) if 'dps' in kwargs : prec = dps_to_prec ( kwargs [ 'dps' ] ) rounding = kwargs . get ( 'rounding' , rounding ) if type ( val ) is cls : sign , man , exp , bc = val . _mpf_ if ( not man ) and exp : return val v = new ( cls ) v . _mpf_ = normalize ( sign , man , exp , bc , prec , rounding ) return v elif type ( val ) is tuple : if len ( val ) == 2 : v = new ( cls ) v . _mpf_ = from_man_exp ( val [ 0 ] , val [ 1 ] , prec , rounding ) return v if len ( val ) == 4 : sign , man , exp , bc = val v = new ( cls ) v . _mpf_ = normalize ( sign , MPZ ( man ) , exp , bc , prec , rounding ) return v raise ValueError else : v = new ( cls ) v . _mpf_ = mpf_pos ( cls . mpf_convert_arg ( val , prec , rounding ) , prec , rounding ) return v