FileStream fileStr = new FileStream(@"Y:\HkTestDECIMAL.xyz",FileMode.Create);
BinaryWriter binWriter = new BinaryWriter(fileStr);
decimal d1 = 123.4567890123m;
decimal d2 = -1000000000.00m;
decimal d3 = 1m / 3m;
double r3 = 123.4567890123;
binWriter.Write(d1);
binWriter.Write(d2);
binWriter.Write(d3);
binWriter.Write(r3);
binWriter.Close();
0000: CB 04
FB 71 1F 01 00 00 00 00 00 00 00 00 0A 00 decimal d1 = 123.4567890123m;
------------------------------------- ===== ~~~~~
| |
| +-------- 10 Kommastellen / Vorzeichen + ( 0 000A )
+----------------------------------------------------- Hex 011F71FB04CB = Dez 1234567890123
0010: 00 E8 76 48 17 00 00 00 00 00 00 00 00 00 02 80 decimal d2 = -1000000000.00m;
------------------------------------- ===== ~~~~~
| |
| +-------- 2 Kommastellen / Vorzeichen - ( 1 0002)
+----------------------------------------------------- Hex 174876E800 = Dez 100000000000
0020: 55 55 55 05 CB 00 B7 14 CA 44 C5 0A 00 00 1C 00 decimal d3 = 1m / 3m;
------------------------------------- ===== ~~~~~
| |
| +-------- 28 Kommastellen / Vorzeichen + ( 0 001C)
+----------------------------------------------------- Hex 0AC544CA14B700CB05555555 = Dez 33333...(28 x 3)
0030: 0B 40
FB 07 3C DD 5E 40 double r3 = 123.4567890123;