Пример #1
0
        public static bool TryMultiply(ulong first, ulong second, out ulong result)
        {
            ulong t;

            result = DoubleArithmetic.BigMul(first, second, out t);
            return(0 == t);
        }
Пример #2
0
        public static bool TryMultiply(long first, long second, out long result)
        {
            long t;
            var  r = DoubleArithmetic.BigMul(first, second, out t);

            result = unchecked ((long)r);
            if (0 > (first ^ second))
            {
                if ((-1 == t && 0 > r) || (0 == t && 0 == r))
                {
                    return(true);
                }
            }
            else
            {
                if (0 == t && r <= (ulong)long.MaxValue)
                {
                    return(true);
                }
            }
            return(false);
        }