Float#
- class basencode.Float(n: Union[float, str, Tuple[Union[int, str]], List[Union[int, str]]], base: int = 10, digits: Optional[List[str]] = None, radix_point: str = '.')#
Bases:
_NumberThe
Floatclass, a child of_Number, for non-negative floating point numbers- Parameters:
n – The number to be converted to decimal and stored
base – The base in which the number provided is represented (this information is used to convert the number to decimal)
digits – The digits used in the provided representation of the number
radix_point – The radix point used in the provided representation of the number, if at all
- repr_in_base(base: int, digits: Optional[List[str]] = None, mode: str = 's', max_frac_places: int = 100) Union[str, List[str]]#
Represents the decimal value of the instance of
_Numberin the base provided.- Parameters:
base – The base to represent the
_Number’s decimal value indigits – The digits to use in the representation; these are also set as the default digits (for this object) for the base provided.
mode – Whether to return the representation as a string or a list
max_frac_places – The maximum number of digits succeeding the radix point
- Returns:
The representation of the
_Number’s decimal value in the base provided- Return type:
str | list[str]