public static void Main()
decimal inputValue = 90m;
var interval = GetInterval(inputValue, precision);
System.Console.WriteLine("first: " + inputValue + ", precision: " + precision + ". low: " + interval.low + " . high: " + interval.high);
interval = GetInterval(inputValue, precision);
System.Console.WriteLine("first: " + inputValue + ", precision: " + precision + ". low: " + interval.low + " . high: " + interval.high);
interval = GetInterval(inputValue, precision);
System.Console.WriteLine("first: " + inputValue + ", precision: " + precision + ". low: " + interval.low + " . high: " + interval.high);
public static Interval GetInterval(decimal baseValue, int precision)
decimal intervalWhole = 1 / (decimal) Math.Pow(10, precision);
decimal intervalHalf = intervalWhole / 2;
var lowValue = baseValue - intervalHalf;
var highValue = baseValue + intervalHalf;
return new Interval(){low = lowValue, high = highValue};