How to convert float to decimal so I can display it numerically down

This is currently my code

byte[] bytes = { 0x42, 0x1c, 00, 00 }; float flt = BitConverter.ToSingle(bytes, 0); 

now I know that the decimal value of the floating point is 39.0, but no matter what I try to do, be it a conversion. identical or just casting it. It displays as 0, I don’t know why it does it, but I could really use the help here. I don't care about accuracy, so you don’t need to worry about that.

Any help is appreciated.

+4
source share
1 answer

returns the byte array order, then it works

 byte[] bytes = { 00, 00, 0x1c, 0x42}; 
+5
source

Source: https://habr.com/ru/post/1403044/


All Articles