Print Page | Close Window

Decimals problem

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=4356
Printed Date: 30 March 2026 at 9:38am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Decimals problem
Posted By: zaboss
Subject: Decimals problem
Date Posted: 19 July 2003 at 2:02pm

Well, I need to get ridd of some decimals... I have a paging records script that do not have to use pagecount, absolutepage and so on...

So in order to do the tric I had to count records and then divide the number of records to the number of my page size. If I use Round(... everything gets rounded at ,5 so, for a pagesize of 10 records, when I have 6 records it shows me 2 pages  to page instead of only one. The only fix I found was the one bellow, but, although it does the job, doesn't look very "pro".

allpages = (allrecords / pagesize) - 0.5
allpages = CInt(allpages) + 1


This way, from 0,5 to 1 it gets rounded at 0, from 1 to 1,9 at 1 and s.o.

So, what I want is a formula to get ridd off all decimals (from X,01 to X,99). As in the example above, instead of 0,6 to have only 0 and get rid of 6.



-------------
Cristian Banu
http://www.soft4web.ro - Soft 4 web



Replies:
Posted By: michael
Date Posted: 19 July 2003 at 4:44pm
allpages = Formatnumber(yournumber,0) would kill all decimals for the value of yournumber

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: ljamal
Date Posted: 19 July 2003 at 7:51pm
Int(number), Fix(Number), CInt(number) and CLng(number) will all result in non decimal numbers. The only difference in the way they round. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vtorifunctions.asp - Microsoft Page for VBScript Functions

-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming


Posted By: zaboss
Date Posted: 20 July 2003 at 4:30am
Thanks jamal for the reourse... Thanks Michael for the solution!

-------------
Cristian Banu
http://www.soft4web.ro - Soft 4 web



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net