0

Hello,

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

thank you very much

4
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by Axelro
0

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)

1

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.

1

Something like this.

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

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

Edited by snippsat: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.