Merge pull request #1 from jepler/warn-bitlength
Improve the diagnostic when the user's circuitpython is too old
This commit is contained in:
commit
b07a53bae3
2 changed files with 6 additions and 1 deletions
|
|
@ -27,7 +27,7 @@ This library depends on:
|
|||
* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
|
||||
|
||||
Note that some CircuitPython core changes were needed to support udecimal.
|
||||
These will be in upcoming release 6.0.0.alpha-4.
|
||||
Please use CircuitPython 6.0.0-rc.1 or newer with udecimal.
|
||||
|
||||
The library also runs on desktop Python3, and should give numerically identical
|
||||
results across all platorms.
|
||||
|
|
|
|||
|
|
@ -160,6 +160,11 @@ except NameError:
|
|||
|
||||
if sys.implementation.name == "circuitpython":
|
||||
|
||||
if not hasattr(int, "bit_length"):
|
||||
raise ImportError(
|
||||
"jepler_udecimal requires int.bit_length. Use CircuitPython 6.0.0-rc.1 or newer."
|
||||
)
|
||||
|
||||
def _as_integer_ratio(f):
|
||||
m, e = _math.frexp(f)
|
||||
m = round(m * (1 << 53))
|
||||
|
|
|
|||
Loading…
Reference in a new issue