예제 #1
0
        /// <summary>
        /// Mul operator *: Multiply two values.
        /// </summary>
        /// <param name="left">A value to multiply with</param>
        /// <param name="right">A value to multiply</param>
        /// <returns>(left.value * right.value, [Normalised(left.scale right.scale)])</returns>
        public static LongST Mul(LongST left, LongST right)
        {
            var result = new LongST(left.Value * right.Value, left.Scale);

            result.Append(right.Scale);
            return(result);
        }
예제 #2
0
        /// <summary>
        /// Div operator /: Divide two values.
        /// </summary>
        /// <param name="left">A value to divide to</param>
        /// <param name="right">A value to divide with</param>
        /// <returns>(left.value / right.value, [Normalised(left.scale, right.scale^-1)])</returns>
        public static LongST Div(LongST left, LongST right)
        {
            if (right.Value == 0.0)
            {
                throw new DivideByZeroException($"{left} / {right} ");
            }
            var result = new LongST(left.Value / right.Value, left.Scale);

            result.Append(right.Scale, reciproce: true);
            return(result);
        }