Home > Net >  C # the decimal to binary
C # the decimal to binary

Time:10-14

For c # decimal fraction will be converted into a binary code, I can only realize the integer transform, the eldest brother, please feel free to comment, in this thank you very much!!!!!!

CodePudding user response:

Take a look at this https://www.cnblogs.com/ClassNotFoundException/p/6198805.html
And why do you want to convert decimal to binary

CodePudding user response:

Brother, I tell you simple, treat floating point Numbers as integer to line,

CodePudding user response:

This is what you need to this? The decimal cannot turn the binary

CodePudding user response:

Decimal conversion before times 10 to the NTH power, into a binary

Come back, and use it every time you earn, divided by 10 N side

Feasible not

CodePudding user response:

Float floatvalue;
Floatvalue=https://bbs.csdn.net/topics/34.4f;
Byte [] b=BitConverter. GetBytes (floatvalue);
TextBox1. Text=the Convert. ToString (b [3], 2) PadLeft (8 '0') + the Convert. ToString (b [2], 2) PadLeft (8 '0') + the Convert. ToString (b [1], 2) PadLeft (8 '0') + the Convert. ToString (b [0], 2) PadLeft (8 '0');
The output for 01000010000010011001100110011010

CodePudding user response:

Decimal fraction binary can ensure accurate?

If you don't need to make sure that
https://www.cnblogs.com/chenjfblog/p/7737426.html
  •  Tags:  
  • C#
  • Related