public void Test_SingleToInt32Bits_NaN()
            {
                for (int i = 0; i < SIGNIFICAND_WIDTH - 1; i++)
                {
                    int x = 1 << i;

                    // Strip out sign and exponent bits
                    int y = x & SIGNIF_BIT_MASK;

                    float[] values =
                    {
                        BitConversion.Int32BitsToSingle(EXP_BIT_MASK | y),
                        BitConversion.Int32BitsToSingle(SIGN_BIT_MASK | EXP_BIT_MASK | y)
                    };

                    foreach (float value in values)
                    {
                        assertTrue("Invalid input " + y + "yielded non-NaN: " + value, float.IsNaN(value));
                        int converted = BitConversion.SingleToInt32Bits(value);
                        assertTrue(string.Format("Non-canoncial NaN bits returned: {0:x8}", converted), 0x7fc00000 == converted);
                    }

                    //testNanCase(1 << i);
                }
            }
        public void Test_Int32BitsToSingleI()
        {
            float f    = 9876.2345f;
            int   bits = BitConversion.SingleToInt32Bits(f);
            float r    = BitConversion.Int32BitsToSingle(bits);

            Assert.AreEqual(f, r, 0F, "Incorrect intBits returned");
        }
        public void Test_SingleToInt32BitsF()
        {
            float f    = 9876.2345f;
            int   bits = BitConversion.SingleToInt32Bits(f);
            float r    = BitConversion.Int32BitsToSingle(bits);

            Assert.IsTrue(f == r, "Incorrect intBits returned");
        }
 public void Test_SingleToInt32Bits_NegativeInfinity()
 {
     assertTrue("Bad conversion for -infinity.", BitConversion.SingleToInt32Bits(float.NegativeInfinity) == unchecked ((int)0xFF800000));
 }
 public void Test_SingleToInt32Bits_PositiveInfinity()
 {
     assertTrue("Bad conversion for +infinity.", BitConversion.SingleToInt32Bits(float.PositiveInfinity) == 0x7F800000);
 }