Python uses bigints by default, which means you can have arbitrarily large numbers. I noticed this when writing an abs macro. The following code produces two different outputs on my machine:
include "std.porth"
macro abs
if dup 0 < do
0 over - swap drop
end
end
-18446744073709551615 abs
// becomes 1 on bare metal, 18446744073709551615 in Python
1 -
if 0 = do
"We're running on bare metal!\n" puts
else
"We're in a simulation!\n" puts
end
Not sure if it's worth fixing in Python as when Porth becomes self-hosted this issue will go away.
At least it's amusing :)
Python uses bigints by default, which means you can have arbitrarily large numbers. I noticed this when writing an
abs
macro. The following code produces two different outputs on my machine:Not sure if it's worth fixing in Python as when Porth becomes self-hosted this issue will go away. At least it's amusing :)