What is the Python equivalent of these C types:
float
double
long
I want to represent a float in the above three forms.
What is the Python equivalent of these C types:
float
double
long
I want to represent a float in the above three forms.
I believe you mean types, not functions. In C, a double is just a double-precision float (meaning smaller numbers are represented more accurately). In Python, it's just a float. Similarly, a long is (was) just an int that stored larger numbers.
In Python 2, there is int, long, and float. However, Python automatically promotes int to long when it grows above sys.intmax. That means there is no point in ever using long in Python. It will turn into a long automatically when it needs to. A float is represented as a double internally.
The short answer is to just use int and float, and don't worry about the underlying implementation. Python abstracts that away for you.
You can convert an int to a float (and back) like this:
#!/usr/bin/python
number = 45
real_number = 3.14159265359
number_as_float = float(number)
real_number_as_int = int(real_number)
See more about the standard Python types here.