Home All Groups Group Topic Archive Search About


Author
20 Mar 2006 5:28 PM
mikekimhome
Hi

It seems like asp is converting  -0.04 to -4.00000000000063E-02
If you run the below code it prints -4.00000000000063E-02


Is there anyway ASP to keep it as float number instead of exponet. Or
is there a function to convert exponet to float number? Thanks in
advance.

---------------------------------------------------------
<%
dim sgPoint
sgPoint = 100 - 100.04
response.write (sgPoint& "<br>")

%>
---------------------------------------------------------

Author
20 Mar 2006 5:37 PM
Ben
Hi, Use FormatNumber...

Response.Write (formatnumber(sgPoint,2))
Author
20 Mar 2006 5:53 PM
Dave Anderson
mikekimh***@gmail.com wrote:
> It seems like asp is converting  -0.04 to -4.00000000000063E-02
> If you run the below code it prints -4.00000000000063E-02
>
>
> Is there anyway ASP to keep it as float number instead of exponet.
> Or is there a function to convert exponet to float number?

There IS no exponent type. The number is already a floating point number:

> dim sgPoint
> sgPoint = 100 - 100.04
> response.write (sgPoint& "<br>")

Response.Write(TypeName(sgPoint)) 'Double

What you want is a string representation of the number, and FormatNumber()
will give it to you.




--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.

AddThis Social Bookmark Button