Example #1
0
        public static DiyFp Normalize(ref DiyFp a)
        {
            DiyFp result = a;

            result.Normalize();
            return(result);
        }
Example #2
0
        public void NormalizedBoundaries(out DiyFp out_m_minus, out DiyFp out_m_plus)
        {
            DiyFp v      = this.AsDiyFp();
            var   __     = new DiyFp((v.f << 1) + 1, v.e - 1);
            DiyFp m_plus = DiyFp.Normalize(ref __);
            DiyFp m_minus;

            if (LowerBoundaryIsCloser())
            {
                m_minus = new DiyFp((v.f << 2) - 1, v.e - 2);
            }
            else
            {
                m_minus = new DiyFp((v.f << 1) - 1, v.e - 1);
            }
            m_minus.f   = (m_minus.f << (m_minus.e - m_plus.e));
            m_minus.e   = (m_plus.e);
            out_m_plus  = m_plus;
            out_m_minus = m_minus;
        }