Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1438
  • Last Modified:

asp classic round down number

How do i round down a number isASP classic

ie 1.7 becomes 1

thanks

dave
0
david_88
Asked:
david_88
  • 2
1 Solution
 
amazingwolf1Commented:
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
 
aprestoCommented:

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
 
david_88Author Commented:
this is the solution i was look for (round down always) thanks worked perfectly
0
 
aprestoCommented:
No problem, happy to help :)
Apresto
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now