- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Get the Machine limits information for integer types in Python
To get the machine limits information for integer types, use the numpy.iinfo() method in Python Numpy. The first parameter is the int_type i.e. the kind of integer data type to get information about.
Steps
At first, import the required library −
import numpy as np
The min is the minimum value of given dtype and max is the minimum value of given dtype.
Checking for int16 type −
a = np.iinfo(np.int16) print("Minimum of int16 type...\n",a.min) print("Maximum of int16 type...\n",a.max)
Checking for int32 type −
b = np.iinfo(np.int32) print("\nMinimum of int32 type...\n",b.min) print("Maximum of int32 type...\n",b.max)
Checking for int64 type −
c = np.iinfo(np.int64) print("\nMinimum of int64 type...\n",c.min) print("Maximum of int64 type...\n",c.max)
Example
import numpy as np # To get the machine limits information for integer types, use the numpy.iinfo() method in Python Numpy # The first parameter is the int_type i.e. the kind of integer data type to get information about. # Checking for int16 type # The min is the minimum value of given dtype. # The max is the minimum value of given dtype. a = np.iinfo(np.int16) print("Minimum of int16 type...\n",a.min) print("Maximum of int16 type...\n",a.max) # Checking for int32 type b = np.iinfo(np.int32) print("\nMinimum of int32 type...\n",b.min) print("Maximum of int32 type...\n",b.max) # Checking for int64 type c = np.iinfo(np.int64) print("\nMinimum of int64 type...\n",c.min) print("Maximum of int64 type...\n",c.max)
Output
Minimum of int16 type... -32768 Maximum of int16 type... 32767 Minimum of int32 type... -2147483648 Maximum of int32 type... 2147483647 Minimum of int64 type... -9223372036854775808 Maximum of int64 type... 9223372036854775807 Result... <class 'numpy.complex128'>
- Related Articles
- Get the Machine limits information for float types in Python
- Get the Machine limits information for float with instances in Python
- Get the Machine limits information for int with instances in Python
- Python Pandas - Get integer location for requested label
- Python Pandas IntervalIndex - Get integer location for requested label
- Get Hash Code for Integer in Java
- Passing Information using GET method in Python
- Get tuple element data types in Python
- Python Pandas – Get the datatype and DataFrame columns information
- Setting the same axis limits for all subplots in Matplotlib
- Get the HTTP header for the information of the content attribute in HTML
- Types of Information Systems
- Python Pandas - Get the Integer number of levels in this MultiIndex
- Maximum value of an integer for which factorial can be calculated on a machine in C++
- What are the types of Information Security?

Advertisements