Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Decimals problem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Decimals problem

 Post Reply Post Reply
Author
zaboss View Drop Down
Senior Member
Senior Member


Joined: 20 August 2002
Location: Romania
Status: Offline
Points: 454
Post Options Post Options   Thanks (0) Thanks(0)   Quote zaboss Quote  Post ReplyReply Direct Link To This Post Topic: Decimals problem
    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
Soft 4 web
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 19 July 2003 at 4:44pm
allpages = Formatnumber(yournumber,0) would kill all decimals for the value of yournumber
Back to Top
ljamal View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Status: Offline
Points: 888
Post Options Post Options   Thanks (0) Thanks(0)   Quote ljamal Quote  Post ReplyReply Direct Link To This Post 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.Microsoft Page for VBScript Functions
Back to Top
zaboss View Drop Down
Senior Member
Senior Member


Joined: 20 August 2002
Location: Romania
Status: Offline
Points: 454
Post Options Post Options   Thanks (0) Thanks(0)   Quote zaboss Quote  Post ReplyReply Direct Link To This Post Posted: 20 July 2003 at 4:30am
Thanks jamal for the reourse... Thanks Michael for the solution!
Cristian Banu
Soft 4 web
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.