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

int precision #8

Open
stxlvt opened this issue Feb 17, 2017 · 1 comment
Open

int precision #8

stxlvt opened this issue Feb 17, 2017 · 1 comment

Comments

@stxlvt
Copy link

stxlvt commented Feb 17, 2017

In 05-Built-in-Scalar-Types.ipynb it says:

C integers are fixed-precision, and usually overflow at some value (often near $2^{31}$ or $2^{63}$, depending on your system). Python integers are variable-precision, so you can do computations that would overflow in other languages:

I don't think it's correct to use the term "precision" to describe integers. They are as precise as they can be in both C and python. A better way to phrase it would be something like this:

C integers are limited to a fixed range, and usually overflow at some value (often near $2^{31}$ or $2^{63}$, depending on your system). Python integers are not limited to any fixed range, but are only limited by the available memory, so you can do computations that would overflow in other languages:

@jakevdp
Copy link
Owner

jakevdp commented Feb 17, 2017

In my experience, "precision" is used in exactly this manner when talking about the bit representation of integers. As one example, take a look at the Wikipedia Article on Integers:

The width or precision of an integral type is the number of bits in its representation. An integral type with n bits can encode 2^n numbers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants