Latest Code Tutorials

Python Double Data Type with Example


Python is not a “statically typed” language. You don’t have to declare the variable before using them. Python supports two types of numbers:

  1. Integers(whole numbers)
  2. floating-point numbers(decimals)

Python Double

Python does not have an inbuilt double data type, but it has a float type that designates a floating-point number. You can count double in Python as float values which are specified with a decimal point.

All platforms represent Python float values as 64-bit “double-precision” values, according to the IEEE 754 standard. In that case, the maximum value a floating-point number can have is approximately 1.8 ⨉ 10308.

To define a floating-point or double number in Python, use the following notations.

data = 7.9


<class 'float'>

You can see that we defined a floating-point number, and if we check its type, then its data type is float.

Python double star operator

Double Star or (**) is an inbuilt Python Arithmetic Operator (Like +, -, *, **, /, //, %). For numeric data types, double-asterisk (**) is defined as an Exponentiation Operator.

x = 1
y = 2
# using double asterisk operator 
c = x ** y 
# using double asterisk operator 
z = 2 * (4 ** 2) + 3 * (4 ** 2 - 10) 



The double star operator in Python is also known as the power operator.

Python double slash

For Python 2.x, the single slash / is neither floor division nor true division.

In Python 3.x version, 3 / 2 will return 1.5 and 3 // 2 will return 1.

The first division is the floating-point division.

The second division is floor division, sometimes also called integer division.

So, the single slash is used for floating-point division, and the double slash is used for floor division.

print(3 / 2)
print(3 // 2)



The // (double slash operator) implements “floor division“, regardless of your type. So 1.0/2.0 will give 0.5, but both 1/2, 1//2 and 1.0//2.0 will give 0.

That is it for the Python double data type tutorial.

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.