Код: Выделить всё
void Main()
{
var x = Double.MinValue;
var y = Double.MaxValue;
var diff = y/10 - x/10;
Console.WriteLine(GetVal(x,6,diff));
Console.WriteLine(GetVal2(x,6,diff));
}
public static double GetVal(double start, int numSteps, double step)
{
var res = start + numSteps * step;
if (res == Double.NaN)
throw new InvalidOperationException();
return res;
}
public static double GetVal2(double start, int numSteps, double step)
{
return start + numSteps * step;
}
Код: Выделить всё
3.59538626972463E+307
Infinity
Подробнее здесь: https://stackoverflow.com/questions/465 ... alculation
Мобильная версия