def test_Mantissa_Exponent_Sign_getters(self) : 

		def float32_assertionAlmostEqual(testValue, f) : 
			def mod(x) : 
				if x < 0 : 
					return -x
				return x

			error = mod((testValue - f.float)*(10**4))
			return error < 1

		f32 = Float(0, length=32)
		f64 = Float(0, length=64)

		# positive
		bin = '01000110000110110100100101100001'
		f32.bin = bin
		self.assertEqual(f32.bin, bin)
		self.assertEqual(f32.raw_sign, '0')
		self.assertEqual(f32.raw_exponent, '10001100')
		self.assertEqual(f32.raw_mantissa, '00110110100100101100001')

		bin = '0100000000010010000110000000000010100111110001011010110001000111'
		f64.bin = bin
		self.assertEqual(f64.bin, bin)
		self.assertEqual(f64.raw_sign, '0')
		self.assertEqual(f64.raw_exponent, '10000000001')
		self.assertEqual(f64.raw_mantissa, '0010000110000000000010100111110001011010110001000111')

		# negative
		bin = '11001011001010011010110101000010'
		f32.bin = bin
		self.assertEqual(f32.bin, bin)
		self.assertEqual(f32.raw_sign, '1')
		self.assertEqual(f32.raw_exponent, '10010110')
		self.assertEqual(f32.raw_mantissa, '01010011010110101000010')

		bin = '1100000000000010101000111101011100001010001111010111000010100100'
		f64.bin = bin
		self.assertEqual(f64.bin, bin)
		self.assertEqual(f64.raw_sign, '1')
		self.assertEqual(f64.raw_exponent, '10000000000')
		self.assertEqual(f64.raw_mantissa, '0010101000111101011100001010001111010111000010100100')

		# +-0
		bin = '00000000000000000000000000000000'
		f32.bin = bin
		self.assertEqual(f32.bin, bin)
		self.assertEqual(f32.raw_sign, '0')
		self.assertEqual(f32.raw_exponent, '00000000')
		self.assertEqual(f32.raw_mantissa, '00000000000000000000000')

		bin = '1000000000000000000000000000000000000000000000000000000000000000'
		f64.bin = bin
		self.assertEqual(f64.bin, bin)
		self.assertEqual(f64.raw_sign, '1')
		self.assertEqual(f64.raw_exponent, '00000000000')
		self.assertEqual(f64.raw_mantissa, '0000000000000000000000000000000000000000000000000000')

		bin = '10000000000000000000000000000000'
		f32.bin = bin
		self.assertEqual(f32.bin, bin)
		self.assertEqual(f32.raw_sign, '1')
		self.assertEqual(f32.raw_exponent, '00000000')
		self.assertEqual(f32.raw_mantissa, '00000000000000000000000')

		bin = '0000000000000000000000000000000000000000000000000000000000000000'
		f64.bin = bin
		self.assertEqual(f64.bin, bin)
		self.assertEqual(f64.raw_sign, '0')
		self.assertEqual(f64.raw_exponent, '00000000000')
		self.assertEqual(f64.raw_mantissa, '0000000000000000000000000000000000000000000000000000')

		# +-inf
		bin = '01111111100000000000000000000000'
		f32.bin = bin
		self.assertEqual(f32.bin, bin)
		self.assertEqual(f32.raw_sign, '0')
		self.assertEqual(f32.raw_exponent, '11111111')
		self.assertEqual(f32.raw_mantissa, '00000000000000000000000')
		bin = '1111111111110000000000000000000000000000000000000000000000000000'

		f64.bin = bin
		self.assertEqual(f64.bin, bin)
		self.assertEqual(f64.raw_sign, '1')
		self.assertEqual(f64.raw_exponent, '11111111111')
		self.assertEqual(f64.raw_mantissa, '0000000000000000000000000000000000000000000000000000')

		bin = '11111111100000000000000000000000'
		f32.bin = bin
		self.assertEqual(f32.bin, bin)
		self.assertEqual(f32.raw_sign, '1')
		self.assertEqual(f32.raw_exponent, '11111111')
		self.assertEqual(f32.raw_mantissa, '00000000000000000000000')

		bin = '0111111111110000000000000000000000000000000000000000000000000000'	
		f64.bin = bin
		self.assertEqual(f64.bin, bin)
		self.assertEqual(f64.raw_sign, '0')
		self.assertEqual(f64.raw_exponent, '11111111111')
		self.assertEqual(f64.raw_mantissa, '0000000000000000000000000000000000000000000000000000')

		# NaN
		bin = '01111111101111111011111111111111'
		f32.bin = bin
		self.assertEqual(f32.bin, bin)
		self.assertEqual(f32.raw_exponent, '11111111')
		self.assertNotEqual(f32.raw_mantissa, '00000000000000000000000')

		bin = '0111111111110000000010000000000000000000000000000000000000000000'	
		f64.float = float('nan')
		self.assertEqual(math.isnan(f64.float), True)
		self.assertEqual(f64.raw_exponent, '11111111111')
		self.assertNotEqual(f64.raw_mantissa, '0000000000000000000000000000000000000000000000000000')
	def testFloat(self) : 

		def float32_assertionAlmostEqual(testValue, f) : 
			def mod(x) : 
				if x < 0 : 
					return -x
				return x

			error = mod((testValue - f.float)*(10**4))
			return error < 1

		f = Float(0, length=32)
		f.float = 4.52344
		bin = '01000000100100001100000000000101'		
		self.assertEqual(float32_assertionAlmostEqual(4.52344, f), True)
		self.assertEqual(f.bin, bin)

		f = Float(0, length=64)
		f.float = 4.52344
		bin = '0100000000010010000110000000000010100111110001011010110001000111'
		self.assertEqual(f.float, 4.52344)
		self.assertEqual(f.bin, bin)

		f.float = -2.33
		bin = '1100000000000010101000111101011100001010001111010111000010100100'
		self.assertEqual(f.float, -2.33)
		self.assertEqual(f.bin, bin)

		# +-0
		f.float = -0.00
		bin = '1000000000000000000000000000000000000000000000000000000000000000'
		self.assertEqual(f.float, -0.00)
		self.assertNotEqual(f.bin, Float(+0.00).bin)
		self.assertEqual(f.bin, bin)

		f.float = +0.00
		bin = '0000000000000000000000000000000000000000000000000000000000000000'
		self.assertEqual(f.float, +0.00)
		self.assertNotEqual(f.bin, Float(-0.00).bin)
		self.assertEqual(f.bin, bin)

		# +-inf
		f.float = -float('inf')
		bin = '1111111111110000000000000000000000000000000000000000000000000000'
		self.assertEqual(f.float, -float('inf'))
		self.assertNotEqual(f.float, float('inf'))
		self.assertEqual(f.bin, bin)

		f.float = float('inf')
		bin = '0111111111110000000000000000000000000000000000000000000000000000'	
		self.assertEqual(f.float, float('inf'))
		self.assertNotEqual(f.float, -float('inf'))
		self.assertEqual(f.bin, bin)

		# NaN
		f.float = float('nan')
		self.assertEqual(math.isnan(f.float), True)

		# integer argument
		f.float = 10
		self.assertAlmostEqual(f.float, 10.000)
		self.assertEqual(f.bin, Float(10.00, length=64).bin)

		def setFloat(f, value) : 
			f.float = value

		#
		self.assertRaises(bitstring.CreationError, setFloat, f, 's')
		self.assertRaises(bitstring.CreationError, setFloat, f, '0111111111110000000000000000000000000000000000000000000000000000')