Reputation: 11416
I would like to know how to write the equivalent representation to the following number in python:
-3.3999999521443642e+38
i did the following:
print(-3.3999999521443642*math.exp(38))
is it correct?
Upvotes: 1
Views: 160
Reputation: 177
Python understands this representation directly.
x = 44e10
print (x)
440000000000.0
It is just an elegant way to represent big numbers in a compact way.
Upvotes: 0
Reputation: 1143
you can use as is
a = -3.3999999521443642e+38
print(a)
output -3.3999999521443642e+38
Upvotes: 1
Reputation: 948
Python supports the scientific notation just as you stated in your question with e
in the number:
>>> a=-3.3999999521443642e+38
>>> print(a)
-3.3999999521443642e+38
>>> type(a)
<class 'float'>
Upvotes: 2