halfDown static method
Rounds halves down (toward negative infinity).
1.5 → 1, 2.5 → 2, -1.5 → -2, -2.5 → -3
Implementation
static double halfDown(double value, {int precision = 2}) {
final factor = math.pow(10, precision);
final scaled = value * factor;
if (scaled >= 0) {
return (scaled - 0.5 + 1).floorToDouble() / factor;
} else {
return (scaled - 0.5).ceilToDouble() / factor;
}
}