using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace libWin32.Win32.NumericConversion.IEEE754 { public class ieee754FloatingPointConverter : I_ieee754FloatingPointConverter { public ieee754FloatingPointConverter() { this.Float = 0; } void FromHex(uint f) { _HexFloat_Representation = f; byte[] bytes = BitConverter.GetBytes(this.HexFloat); float _f = BitConverter.ToSingle(bytes, 0); _Float_Representation = _f; } void ToHex(float f) { _Float_Representation = f; byte[] bytes = BitConverter.GetBytes(this.Float); int i = BitConverter.ToInt32(bytes, 0); _HexFloat_Representation = (uint)i; } #region I_ieee754FloatingPointConverter Memvers private float _Float_Representation; private uint _HexFloat_Representation; public float Float { get { return _Float_Representation; } set { this.ToHex(value); } } public uint HexFloat { get { return _HexFloat_Representation; } set { this.FromHex(value); } } #endregion } }