Round to nearest (corresponds to Pascal Shisha)
double shisha(double x, int n) { x = x * pow(10, n - 1); x = (x + 0.5).truncateToDouble(); return x * pow(10, 1 - n).toDouble(); }