Amrmsmb
Amrmsmb

Reputation: 11416

How to write exponential representation

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

Answers (3)

Abdallah Ibrahim
Abdallah Ibrahim

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

balu
balu

Reputation: 1143

you can use as is

a = -3.3999999521443642e+38
print(a)

output -3.3999999521443642e+38

Upvotes: 1

leosh
leosh

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

Related Questions