CodePudding user response:
You can use BitConverter ToDoubleCodePudding user response:
static void Main (string [] args)
{
Var a=1234.5 f;
Var b=BitConverter. GetBytes (a);
Var c=BitConverter. ToString (b) Replace (" - ", "");
Console. WriteLine (c);
B=BitConverter. GetBytes (Convert. ToInt32 (c, 16));
Console. WriteLine (BitConverter. ToSingle (b.R everse (). The ToArray (), 0));
}
CodePudding user response:
B.R everse is () in the second floor?CodePudding user response:
Pay attention to the byte order, Reverse () bytes is upside down, on the Intel processor, the low byte in the front, some platform is on the contrary,CodePudding user response:
From 16 mechanism of four bytes array to floating-point number:Byte [] bytes=new byte [4].
BitConverter. ToSingle (bytes, 0);