Skip to content

pySCG: Numbers related landing page to explain generic issues, such as array with ctypes and numpy #712

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

Open
myteron opened this issue Dec 17, 2024 · 0 comments

Comments

@myteron
Copy link
Contributor

myteron commented Dec 17, 2024

Numbers landing page to explain generic issues around:

  • Hardware limitations
  • A Python int can be much bigger than what is known as 64 bit int and why NUM13 does not apply
  • Python relation to primitive int numpy ctypes
  • implicit conversion can come unexpected
  • explicit conversion can have unexpected results.
  • Upper boundaries
  • Lower boundaries.

Content that is helpful for understanding numbers or above points and applicable for all numeric related issues such as
Avoid loss of precision when converting primitive integers to floating-point

Pythons array module is the closest thing to primitive types mentioned in the Java or C rules such as unsigned or signed int, float, long or char. The array module should be at least mentioned together with numpy and ctypes.

CWE-191: Detect or prevent integer overflow

"by classes and are protected against overflows.  Primitive types such as numpy , time  or ctype share issues known from C , or C++"

CWE-1335: Incorrect Bitwise Shift of Integer

CWE-1335: Promote readability and compatibility by using mathematical written code with arithmetic operations instead of bit-wise operations

"outcomes. Python's ctypes  module allows integration of C based system libraries into Python and direct access to C-type variables that can have"

CWE-197: Control rounding when converting to less precise numbers

"Python has ctypes module allowing users to work with many different data types. "

@myteron myteron changed the title pySCG: Numbers related landing page to explain generic issues pySCG: Numbers related landing page to explain generic issues, such as array with ctypes and numpy May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant