C#-Code
using System;
using System.Linq;
public class Program
{
public static void Main()
{
double[] _in = {7.1, 8.4, -2.4, -2.6, -8.3};
double[] _out = _in.Select(x => round(x, 5)).ToArray();
for(int i = 0; i < _in.Length; i++){
Console.WriteLine("{0} => {1}", _in[i], _out[i]);
}
}
private static int round(int val, int factor){
return (int)(Math.Round((double)val / (double)factor, 0) * factor);
}
private static float round(float val, float factor){
return (float)(Math.Round((double)val / (double)factor, 0) * factor);
}
private static double round(double val, double factor){
return Math.Round(val / factor, 0) * factor;
}
private static decimal round(decimal val, decimal factor){
return Math.Round(val / factor, 0) * factor;
}
}