This commit is contained in:
blueloveTH 2023-06-15 02:51:40 +08:00
parent 681e674ff5
commit 439314dc97
2 changed files with 25 additions and 1 deletions

View File

@ -40,4 +40,6 @@ The easiest way to test a feature is to [try it on your browser](https://pocketp
6. `__ne__` is not required. Define `__eq__` is enough. 6. `__ne__` is not required. Define `__eq__` is enough.
7. Raw string cannot have boundary quotes in it, even escaped. See [#55](https://github.com/blueloveTH/pocketpy/issues/55). 7. Raw string cannot have boundary quotes in it, even escaped. See [#55](https://github.com/blueloveTH/pocketpy/issues/55).
8. In a starred unpacked assignment, e.g. `a, b, *c = x`, the starred variable can only be presented in the last position. `a, *b, c = x` is not supported. 8. In a starred unpacked assignment, e.g. `a, b, *c = x`, the starred variable can only be presented in the last position. `a, *b, c = x` is not supported.
9. A `Tab` is equivalent to 4 spaces. You can mix `Tab` and spaces in indentation, but it is not recommended. 9. A `Tab` is equivalent to 4 spaces. You can mix `Tab` and spaces in indentation, but it is not recommended.
10. `%`, `&`, `//`, `^` and `|` for `int` behave the same as C, not python.
11. `int` is of limited precision. For arbitrary sized integers, you may use `long` type explicitly.

22
docs/features/long.md Normal file
View File

@ -0,0 +1,22 @@
---
icon: dot
title: Arbitrary Sized Integers
---
Unlike cpython, pkpy's `int` is of limited precision.
In 32 bit platforms, it is 30 bit;
in 64 bit platforms, it is 62 bit.
For arbitrary sized integers, we provide a builtin `long` type, just like python2's `long`.
`long` is implemented via pure python in [_long.py](https://github.com/blueloveTH/pocketpy/blob/main/python/_long.py).
```python
a = long(2) # use long() to create a long explicitly
print(a ** 1000)
# 10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069376L
```
!!!
This feature is still under development.
Some operations are missing, and some operations are not optimized.
!!!