Hello,

My quaestion is how to convert an integer to an exponential number i.e. 484.000E-2?

thank you very much

Your number is unnormalized 0.482E1 ie 4.82. I do not understand what you want as you talk power of integer like (482**-2) but you are giving floating point number 482.0E-2 = 482 *( 10**-2)

I think you are either talking about a type (float in Python) or a representation which you can do with string formatting.

Type

integerValue = 484
floatValue = float(integerValue)

Representation

print("%e"%integerValue)

If neither of these is what you want, then you must ask your question more precisely.

Something like this.

def foo(num):
    ''' Return an exponential notation'''
    return '%e' % num

print foo(3000000000000000000000000)
#-->3.000000e+24

Thank you !!!
Work done :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.