shisha function

double shisha(
  1. double x,
  2. int n
)

Round to nearest (corresponds to Pascal Shisha)

Implementation

double shisha(double x, int n) {
  x = x * pow(10, n - 1);
  x = (x + 0.5).truncateToDouble();
  return x * pow(10, 1 - n).toDouble();
}