Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] Percent Function

Author
Message
lucifer 1101
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Melbourne, Australia
Posted: 6th Jul 2009 05:27 Edited at: 6th Jul 2009 05:28
EDIT: For DBP, forgot to put it in...

I made this for a little program im making because i couldnt find one on here that really worked, especialy with floats...



its best used with floats..

usage can be like -



which would return 50 (u could use any other number also, 200% would double it and make 200)

you could also use it to take away a percentage from a number like so



as you can see it can be pretty useful for multiple things..

C&C Welcome
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 6th Jul 2009 06:07 Edited at: 6th Jul 2009 06:09
In it's current state it's somewhat pointless, because to find a percent of a value, you can multiply the value by the percent in decimal form, i.e. 40% of 100 is 100 * 0.40.

However it can be improved if you use a start and end value:



That way you could find, say, the value that's 40% of the way from 100 to 200 using Percent(100,200,40).

i like orange
lucifer 1101
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Melbourne, Australia
Posted: 6th Jul 2009 07:01
yes very good, thankyou...
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 6th Jul 2009 11:17
At least if someone uses the search button they will find two ways of doing it here.

Dark Physics makes any hot drink go cold.

Login to post a reply

Server time is: 2024-05-18 18:31:23
Your offset time is: 2024-05-18 18:31:23