Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 playing with numbers
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 29 December 2004 :  02:36:44  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
doing some playing around with math in asp and stuff... I'm trying to figure out an efficient way to calculate percentages...

What I've got so far is the simple stuff, divide the numerator by the denominator, then move the decimal 2 points right.

Only problem I've run into is moving the decimal 2 points to the right...

anyone know how I can do this?

-Stim

Edited by - Da_Stimulator on 29 December 2004 02:37:37

dayve
Forum Moderator

USA
5820 Posts

Posted - 29 December 2004 :  02:43:42  Show Profile  Visit dayve's Homepage
Percentage = FormatNumber((X/Y) * 100,2)

Go to Top of Page

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 29 December 2004 :  02:50:17  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
ok... I understand the X/Y * 100 part, whats the 2 for?

nevermind... "2" decimals, got it, thx dayve

-Stim

Edited by - Da_Stimulator on 29 December 2004 02:53:27
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 29 December 2004 :  16:28:17  Show Profile  Visit Gremlin's Homepage
Why not use FormatPercent ?

Response.Write FormatPercent(X/Y)

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 29 December 2004 :  16:30:22  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
would that put a % behind it? if thats the case I dont want to, becuase after I get the percentage value I manipulate the number more...

-Stim
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 29 December 2004 :  19:05:44  Show Profile  Visit dayve's Homepage
quote:
Originally posted by Da_Stimulator

would that put a % behind it? if thats the case I dont want to, becuase after I get the percentage value I manipulate the number more...


yes it does which is why I never use it. I figure if I need the % symbol, I will just concatenate it with the symbol.

Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 29 December 2004 :  20:00:59  Show Profile  Visit Gremlin's Homepage
Each to their own I guess just showing theres more than one way to eat a pineapple.

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 29 December 2004 :  23:51:43  Show Profile
quote:
Originally posted by Gremlin

Each to their own I guess just showing theres more than one way to eat a pineapple.


======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.18 seconds. Powered By: Snitz Forums 2000 Version 3.4.07