c# - Got hit by an OverflowException -
in method below on last line i'm getting exception:
system.overflowexception: value either large or small int32.
i can't explain why because i'm checking explicitly that:
private int32 convertvalue(double value) { if (value > int32.maxvalue) { console.writeline("couldn't convert value " + value + " int32"); return int32.maxvalue; } else if (value < int32.minvalue) { console.writeline("couldn't convert value " + value + " int32"); return int32.minvalue; } else { return convert.toint32(value); } }
also check double.isnan(value)
.
compares nan
yield false.
Comments
Post a Comment