Repro:
Int128 a = Int128.MaxValue;
Int128 b = 0;
Int128 result = a / b;
or
UInt128 a = UInt128.MaxValue;
UInt128 b = 0;
UInt128 result = a / b;
If a is set to a small value, like 42, this results in the expected DivideByZeroException. But when a is set to a large value, like MaxValue, it instead throws an ArgumentOutOfRangeException.
Unhandled exception. System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
at System.UInt128.<op_Division>g__DivideSlow|110_2(UInt128 quotient, UInt128 divisor)
at System.UInt128.op_Division(UInt128 left, UInt128 right)
at System.Int128.op_Division(Int128 left, Int128 right)
Repro:
or
If
ais set to a small value, like 42, this results in the expectedDivideByZeroException. But whenais set to a large value, likeMaxValue, it instead throws an ArgumentOutOfRangeException.