Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Working with numbers

I have a number that I calculated and is 0.0000000001374 I want to change this number to 1.374E-10 so I can put it in a string that way. How can I change the number to the value with exponent?
[193 byte] By [AM003295] at [2007-11-11 10:23:34]
# 1 Re: Working with numbers
Dim D As Double
Dim S As String

D = 0.0000000001374
S = Format$(D, "#.###E-")
Phil Weber at 2007-11-11 17:22:47 >
# 2 Re: Working with numbers
Phil;
Dim X As double ;)

Is there a function that can understand the "E" automaticly ?
I remember once a time I used something like that :
//Not a code, an explication :
a = instr(StrValue, "E")
if (a+1) = "-" then number = value / val(mid(StrValue,a+1))
else number = value * val(mid(StrValue,a))
//--
I mean can do the converse of the original question ?
Amahdy at 2007-11-11 17:23:47 >
# 3 Re: Working with numbers
? Val("1.374E-10")
Phil Weber at 2007-11-11 17:24:45 >
# 4 Re: Working with numbers
Oooops .
Thanks ! :)
Amahdy at 2007-11-11 17:25:48 >