sebassdc
6/9/2016 - 4:29 AM

calibra.h

/*
  -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;
}