Methods dealing with rationals.
Bases: object
Methods for Radices.
Convert rational value to a base.
Parameters: |
|
---|---|
Returns: | the conversion result and its relation to actual result |
Return type: | Radix * int |
Raises BasesValueError: | |
if to_base is less than 2 |
Complexity: Uncalculated.
Bases: object
An object containing information about a rational representation.
Such values can not be ordered, but can be compared for equality.
This value as an int, rounded according to method.
Parameters: | method – rounding method |
---|---|
Raises BasesValueError: | |
on bad parameters | |
Returns: | corresponding int value |
Return type: | int |
Return this value as a Rational.
Returns: | this radix as a rational |
---|---|
Return type: | Rational |
Return a representation of a Radix according to config.
Parameters: |
|
---|
Return value in base.
Returns: | Radix in base |
---|---|
Return type: | Radix |
Raises ConvertError: | |
if base is less than 2 |
This value with fractional part rounded to precision digits according to method.
Parameters: |
|
---|---|
Raises BasesValueError: | |
on bad parameters |
Precondition: Radix is valid and canonical
Complexity: O(len(components))
Bases: object
Miscellaneous methods for rationals.
Round value to an int according to method.
Parameters: |
|
---|---|
Returns: | rounded value and relation of rounded value to actual value. |
Return type: | (int * int) |
Complexity: O(1)