roundDouble function
Rounds value to places decimal places, then buckets the result to
the nearest marketed RAM size (2, 4, or 6 GB).
Implementation
int roundDouble(double value, int places) {
num mod = pow(10.0, places);
final totalRamInGB = ((value * mod).round().toDouble() / mod);
if (totalRamInGB >= 7) {
return 6;
} else if (totalRamInGB >= 5) {
return 4;
} else {
return 2;
}
}