Normalize() static private méthode

static private Normalize ( Rhino a ) : Rhino.V8dtoa.DiyFp
a Rhino
Résultat Rhino.V8dtoa.DiyFp
Exemple #1
0
		// Returns the two boundaries of first argument.
		// The bigger boundary (m_plus) is normalized. The lower boundary has the same
		// exponent as m_plus.
		internal static void NormalizedBoundaries(long d64, DiyFp m_minus, DiyFp m_plus)
		{
			DiyFp v = AsDiyFp(d64);
			bool significand_is_zero = (v.F() == kHiddenBit);
			m_plus.SetF((v.F() << 1) + 1);
			m_plus.SetE(v.E() - 1);
			m_plus.Normalize();
			if (significand_is_zero && v.E() != kDenormalExponent)
			{
				// The boundary is closer. Think of v = 1000e10 and v- = 9999e9.
				// Then the boundary (== (v - v-)/2) is not just at a distance of 1e9 but
				// at a distance of 1e8.
				// The only exception is for the smallest normal: the largest denormal is
				// at the same distance as its successor.
				// Note: denormals have the same exponent as the smallest normals.
				m_minus.SetF((v.F() << 2) - 1);
				m_minus.SetE(v.E() - 2);
			}
			else
			{
				m_minus.SetF((v.F() << 1) - 1);
				m_minus.SetE(v.E() - 1);
			}
			m_minus.SetF(m_minus.F() << (m_minus.E() - m_plus.E()));
			m_minus.SetE(m_plus.E());
		}