Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain numeric widths, unsigned/signed integers, and overflow/underflow #486

Open
rhagenson opened this issue Jan 13, 2022 · 0 comments
Open
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@rhagenson
Copy link
Member

We have previously assumed a more expansive numeric type knowledge for Pony learners. Pony can be the first language where a developer must consider numeric issues such as numeric widths, signed vs unsigned integers, and overflow/underflow so the Arithmetic section of the Tutorial should include explanations of these topics.

We suggest this additional content be placed early in the section prior to any mention of these terms and provide a link for those already familiar with these topics to skip ahead to where the presumption of this knowledge begins (that is, the continuation of current content). This additional content must include examples involving the bounds of numerics -- minimum and maximum values at a given width, involvement of zero for signed and unsigned integers, and how underflow/overflow interacts with the former two topics.

For example:

// Unsigned integers, as many would be familiar with, but with possibly unfamiliar wraparound
U8(0) - 1 == 255

// Unsigned integers, as many would be familiar with, but with possibly unfamiliar wraparound
U8(255) + 1 == 0

// Signed integers, where wraparound does not occur at zero
I8(0) - 1 == -1

// Signed integers, where wraparound does not occur at zero
I8(-128) - 1 == 127

The examples will be ideally short, however should cover all topics to ensure explicitly addressing the interaction between numeric issues.

@SeanTAllen SeanTAllen added good first issue Good for newcomers help wanted Extra attention is needed labels Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants