Created
June 9, 2016 04:29
-
-
Save sebassdc/7f7e3a87bf7e400e33b970adb30d05e8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
-number: input number | |
-min: Minimun number | |
-max: Maximun number | |
given a number and a minimun a maximun | |
calculate the equivalent percentage | |
*/ | |
float valtope(float number, float min, float max){ | |
float res = ((number - min) / (max - min)) * 100; | |
return res; | |
} | |
/* | |
-percent: input percentage | |
-min: Minimun number | |
-max: Maximun number | |
given a percentage and a minimun a maximun | |
calculate the equivalent number | |
*/ | |
float petoval(float percent, float min, float max){ | |
float res = (percent/100.0) * (max - min) + min; | |
return res; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment