Beispiel #1
0
        public static UFix8 CheckedAdd(UFix8 left, UFix8 right)
        {
            UFix16 value;

            try                         { value = UFix16.CheckedAdd(left, right); }
            catch (OverflowException)   { throw new OverflowException(); }

            if ((float)value < MinValue || (float)value > MaxValue)
            {
                throw new OverflowException();
            }

            return((UFix8)value);
        }
Beispiel #2
0
 public void CheckedAddTest([RandAddOver] double left, [RandAddOver] double right) =>
 Assert.That(() => UFix16.CheckedAdd((UFix16)left, (UFix16)right),
             ((Fix(left) + Fix(right)) is <= UFix16Max and >= UFix16Min)