Hello all. I have this function to convert to scientific notation:

Code:
Function (StringVar dInput)
local NumberVar iCount := 0;
local NumberVar dCurrent := cdbl(dInput);
local StringVar sReturn := "";

//dcurrent := dinput
while (dCurrent<-10 or dCurrent>10) do
(
    dcurrent := dcurrent /10 ;
    iCount := iCount+1;
);

round(dCurrent, 1) & "E" & sgn(dInput) * int(iCount);
The function works great, only problem is that I get something like "3.4E3.00" instead of "3.4E3".

Any reason why that anyone can think of?