IIS ASP - asp exponent problem

This is Interesting: Free IT Magazines  
Home > Archive > IIS ASP > March 2006 > asp exponent problem





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author asp exponent problem
mikekimhome@gmail.com

2006-03-21, 3:16 am

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>")

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

Ben

2006-03-21, 3:16 am

Hi, Use FormatNumber...

Response.Write (formatnumber(sgPoint,2))

Dave Anderson

2006-03-21, 3:16 am

mikekimhome@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.


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com