Solved

asp classic round down number

Posted on 2009-03-31
4
1,298 Views
Last Modified: 2012-05-06
How do i round down a number isASP classic

ie 1.7 becomes 1

thanks

dave
0
Comment
Question by:david_88
  • 2
4 Comments
 
LVL 4

Expert Comment

by:amazingwolf1
ID: 24029646
Hi:
-----------------------------
Example 1
dim x
x=24.13278
document.write(Round(x))

Output:24

-----------------------------
Example 2
dim x
x=24.13278
document.write(Round(x,2))

Output:24.13
-----------------------------
HTH
0
 
LVL 23

Accepted Solution

by:
apresto earned 500 total points
ID: 24029699

But if this is 24.57 it will round to 25. If you want this then amazingwolf1 has it bang on. If you want to round down no matter what the decimal. You could just take the number before the decimal, problem solved.

dim var

var = 12.56

Response.write Left(cstr(var), InStr(cstr(var), ".")-1)

Open in new window

0
 

Author Closing Comment

by:david_88
ID: 31564855
this is the solution i was look for (round down always) thanks worked perfectly
0
 
LVL 23

Expert Comment

by:apresto
ID: 24030445
No problem, happy to help :)
Apresto
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now