/[RomCheater]/trunk/Win32/libWin32/Win32/NumericConversion/IEEE754/ieee754FloatingPointConverter.cs
ViewVC logotype

Contents of /trunk/Win32/libWin32/Win32/NumericConversion/IEEE754/ieee754FloatingPointConverter.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 88 - (show annotations) (download)
Wed May 9 20:52:20 2012 UTC (9 years, 4 months ago) by william
File size: 1208 byte(s)

1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5
6 namespace libWin32.Win32.NumericConversion.IEEE754
7 {
8
9 public class ieee754FloatingPointConverter : I_ieee754FloatingPointConverter
10 {
11
12 public ieee754FloatingPointConverter() { this.Float = 0; }
13 void FromHex(uint f)
14 {
15 _HexFloat_Representation = f;
16 byte[] bytes = BitConverter.GetBytes(this.HexFloat);
17 float _f = BitConverter.ToSingle(bytes, 0);
18 _Float_Representation = _f;
19 }
20 void ToHex(float f)
21 {
22 _Float_Representation = f;
23 byte[] bytes = BitConverter.GetBytes(this.Float);
24 int i = BitConverter.ToInt32(bytes, 0);
25 _HexFloat_Representation = (uint)i;
26 }
27 #region I_ieee754FloatingPointConverter Memvers
28 private float _Float_Representation;
29 private uint _HexFloat_Representation;
30 public float Float { get { return _Float_Representation; } set { this.ToHex(value); } }
31 public uint HexFloat { get { return _HexFloat_Representation; } set { this.FromHex(value); } }
32 #endregion
33 }
34 }

  ViewVC Help
Powered by ViewVC 1.1.22