Please see comments to the questions — by Matt T Heffron and mine. This is the problem.
And here is the solution: instead of pointless "100000" use
int.MaxValue
(and, to find the maximum, start with
int.MinValue
):
http://msdn.microsoft.com/en-us/library/system.int32.minvalue.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.int32.maxvalue.aspx[
^].
All other integer types have similar property.
With floating-point types, things are way more interesting. You should use
NegativeInfinity
and
PositiveInfinity
:
http://msdn.microsoft.com/en-us/library/system.double.negativeinfinity.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.double.positiveinfinity.aspx[
^].
The fundamentally important and amazing feature is: infinity values correctly compare with non-infinite values with operators '>', '<', '>=', '<=' and '=='!
—SA