Skip to content
This repository was archived by the owner on Nov 11, 2021. It is now read-only.
This repository was archived by the owner on Nov 11, 2021. It is now read-only.

Parity error between numbers in simulation and compilation #136

Description

@Nabushika

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 :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions