"LONG" Long Integers
Fingerprint ID: | 0x4c4f4e47 |
New in version 0.5-rc2.
This fingerprint, from RC/Funge-98, implements arithmetic operations of the long integers. It provides the following commands:
- A : aL bL — (a+b)L
- Adds two long integers.
- B : xL — abs(x)L
- Calculates the absolute value of x.
- D : aL bL — (a÷b)L
- Divides two long integers. If the divisor is zero it pushes zero. PyFunge tries to emulate RC/Funge-98’s behavior as much as possible, so it uses C-like division (remainder’s sign is same to dividend’s one) instead of Python division.
- E : x — xL
- Pushes a long integer from given integer.
- L : aL n — (a << n)L
- Shift a left by n bits. Reflects if n is negative.
- M : aL bL — (a×b)L
- Multiplies two long integers.
- N : xL — -xL
- Negates the long integer.
- O : aL bL — (a mod b)L
- Calculates the remainder of two long integers. If the divisor is zero it pushes zero. PyFunge tries to emulate RC/Funge-98’s behavior as much as possible, so it uses C-like division (remainder’s sign is same to dividend’s one) instead of Python division.
- P : xL —
- Prints the long integer.
- R : aL n — (a >> n)L
- Shift a right by n bits. Reflects if n is negative.
- S : aL bL — (a-b)L
- Subtracts two long integers.
- Z : strs — xL
- Tries to parse the string into the long integer. Reflects on failure.
Long integer is not that long in PyFunge, since it is restricted to 64 bits. It can be useful for implicitly wrapping integers (as in C and other languages) though. Long integer occupies two stack cells: the bottom one is the upper 32 bits, and the top one is the lower 32 bits. All bits over 32 bit boundary are ignored.