calcPercent function

double calcPercent(
  1. double value,
  2. double total
)

Calculates the percent of value of total with accuracy up to a tenth.

Implementation

double calcPercent(final double value, final double total)
{
  return (value * 1000 / total).floorToDouble() / 10;
}