basfr.blogg.se

Gx works 2 read only
Gx works 2 read only













That makes the mantissa actually 24 bits long when all we have are 23 bits of storage. So in this case it's always safe to assume that the leading digit is a 1 and therefore we don't have to store it. You wouldn't have 0.1 x 2 4 as it wouldn't be normalized.

gx works 2 read only gx works 2 read only

In terms of using binary we'll always have a 1 in front (i.e. The exponent is always adjusted to make this happen. Floating point numbers are typically in a normalized form with one digit to the left of the decimal (i.e. The trick comes about by realizing that scientific notation allows us to write numbers in many different way. Since it's in base 2 (or binary) there's a little optimization trick that can be done to save one bit. Normally the base would be 10 but in this case it will be 2 since we are only dealing in binary. The final nomenclature in scientific notation would be: (sign) mantissa x base exponent In our example above it was the 1.23456 part of the scientific notation. The mantissa (or significand, if that is any easier to say) represent the precision bits of the number. So a stored value of 200 indicates an exponent of 73 (200-127). Any number above 127 will be a positive exponent. Any number below 127 will cause a negative exponent. Basically this means that at a value of 127 the exponent is 0. Here we are again trying to deal with negative numbers but in this case the geeks decided to use what's called a bias or offset of 127. It tells us which way the decimal should go so it needs to be positive (go to the right) or negative (go to the left). The exponent is the same as our little number above the 10 in scientific notation. Flip the bit and you change the sign of the number. If the bit is 0 then the number is positive but if it is a 1 then it is negative. Here it is in all it's glory.įirst there is the sign bit. Due to a lack of originality, it officially became called "IEEE Standard 754". The FormatĪt some point in history a bunch of geeks got together and agreed upon a certain format or layout for a 32-bit floating point number. We could just as easily do scientific notation in hexadecimal (123.ABC x 16 2) or even binary ( 1.0101 x 2 2, this binary one becomes important later on). (Just a heads up, in the PLC you may be able to use scientific notation but in a different form like 1.23456E2 which is the same as a first example.) The number 10 here means we're dealing in decimal. That little -2 indicates we move the decimal point in the opposite direction to the left. That 10 with a little 2 above is telling us to move the decimal two spaces to the right to get the real number. Oh yeah? What's scientific notation? Scientific notation represents numbers as a base number and an exponent. Sinking Deeper into Floating Point Numbersįloating point is basically a representation of scientific notation. If you're still staying afloat in all these concepts and want to understand more then read on. The resulting ladder logic would look like below. Then we use the special DIVR instruction to divide it with a real number and get our reading. So the BTOR instruction is used to convert the decimal number to a real number format. This is easily done with real numbers but our reading is in decimal. So essentially to get our real world reading we would need to divide 4095 by 16.38 (4095 reading / 250 max pressure). In our PLC the max number is represented by 4095 (FFF in hex). Our PLC is reading a pressure transducer input whose max reading is 250 psi. In this case we're using an Automation Direct DL250 PLC which conveniently has the ability to handle real numbers (floating point). Real Numbers in the Real WorldĪt this point let's deal with an example. The trick is to get some sort of format where the decimal point can "float" around the number. This might be all we need but it can get a bit tricky when it comes to math where we want to retain a remainder. For instance, a number like 2300 in a word could be taken to represent 23.00 if the decimal point is "implied" to be in the 1/100th place. We'd have to use some tricks to maybe imply a decimal point. Before, a word could only represent an integer, that is, a whole number. It allows for such large numbers that we can even keep track of the US national debt.įloating point gives us an easy way to deal with fractions. Up until this point the range of numbers we were able to represent with a double word would be from 0 to 4,294,967,295.

gx works 2 read only

Gx works 2 read only 32 bit#

Floating point numbers (also known as 'real numbers') give a certain freedom in being able to represent both very large and very small numbers in the confines of a 32 bit word (that's a double word in our PLCs).













Gx works 2 read only