I've been playing with the notion of making my own game engine and these are some starter functions I wrote for in game stats.
double percent(double n,double d)
return n / d * 100;
double ratio(double n,double d)
return n / d;