Quick Question

Hello Saturn;
Easy.
6.7 converts to 01000000110101100110011001100110
No, really. I mean it.
IEEE has developed a binary representation for floating-point values in single-precision (32 bit REAL) or double-precision (64-bit REAL) formats that is followed by most (if not all) computer and PLC systems. It is designated IEEE754.
This first link takes you to a binary converter for floating-point values; the second shows you a bit of the math theory behind this representation.

http://www.h-schmidt.net/FloatConverter/IEEE754.html
https://en.wikipedia.org/wiki/Single-precision_floating-point_format

Hope this helps,
Daniel Chartier
 
Normally, you either use a FLOAT instead of an INT, or you multiply the INT by a factor of 10, so its a whole number. 6.7 becomes 67, and you have to treat it special in your code.

I've never come across a standard for how a non-integer binary would be written (besides as a float), but here is my thought:

If normal binary is the power of 2 increasing as you go right (2^0=1, 2^1=2, 2^2=4, etc) , I would think that you could also extend the binary to the left by decreasing (2^-1=.5, 2^-2=.25, etc). This is how normal decimal notation works. The trick is that the fraction part is an approximation. 6.7 really means "some number between 6.65 and 6.74" (or something similar, depending how you round). So just as you represent the 6 as 4*1+2*1+1*0, you could represent .7 as .5*1+.25*0+.125*1+.0625*1=.6875.

Thus 6.7 gets rounded to 6.6875 and becomes 110.1011.

The actual .7 part would be very hard to represent in terms of powers of 2. It becomes an infinite series, getting ever closer, but never exactly there.
 

Similar Topics

So the quick and short of the situation is that I designed an axle press that was sent to one of my company's other facilities. That facility just...
Replies
19
Views
4,217
So I have a PID loop on an 1756-L61 running V17 software just for background. Also the PID PV is a pressure transmitter and the CV is speed sent...
Replies
1
Views
893
Has anyone come across a 3 turn potentiometer that is panal mounted with either a 22 or 30 mm hole? I have been looking but nothing so far. They...
Replies
20
Views
4,673
Hi, I am just learning CCW, finally got connected to a micro820. I'm wondering what the Version number means. The program that was already in the...
Replies
1
Views
1,616
How do I measure if I am getting a signal out of the plc output? All of the outputs are giving me the same voltage, however I am certain that not...
Replies
6
Views
2,165
Back
Top Bottom