Exemplo n.º 1
0
        private void CastToCanonicalFormSmallNumbers()
        {
            var DotNode  = Mantissa.Find(_dot);
            var TempNode = Mantissa.First;

            if (DotNode == null)
            {
                return;
            }

            if (DotNode.Previous.Value != 0)
            {
                return;
            }

            while (TempNode.Next != null)
            {
                if ((TempNode.Previous != null) && (TempNode.Previous.Value == _dot) && (TempNode.Value == 0))
                {
                    Mantissa.Remove(TempNode);

                    TempNode = DotNode;

                    Order--;
                }

                TempNode = TempNode.Next;
            }

            TempNode = DotNode.Next;
            Mantissa.Remove(DotNode.Next);
            Mantissa.Remove(DotNode.Previous);
            Mantissa.AddFirst(TempNode);
            Order--;
        }
Exemplo n.º 2
0
        private void RoundingResult()
        {
            int  countItemsToRemove     = 0;
            byte firstWholeItemIncrease = 0;

            var TempNode = Mantissa.First;

            countItemsToRemove = (Mantissa.Count - 1) - _sizeOfMantissa;

            RemoveItemsFromMantissa(countItemsToRemove, Mantissa);

            firstWholeItemIncrease = RoundingValue(Mantissa.Last);

            if (firstWholeItemIncrease == 1)
            {
                Mantissa.AddFirst(firstWholeItemIncrease);
            }

            byte roundingValue = RoundingValue(Mantissa.Last);

            Mantissa.Last.Value += roundingValue;
        }