Hi, what are basic applications of integers and floating point ?

That is a difficult question because so many answers are possible depending mostly on the context and previous knowledge of the person asking. A very quick basic attempt at an answer: integers are good for things that you mostly get in wholes and can count. Floating point is for numbers that can be anything, including anything in between two adjacent numbers.



Bulk product (like sand) is typically measured in tons and you can get 2.5 tons. That would require a floating point number.



Apples, oranges, packages, number of cookies in a box, number of bottles in a crate, number of identical bags/boxes on a pallet, products that are made one by one are typical integers. Up to the point where you get so many of them that you trade tons instead. Then you would prefer floating point again.
 
Counting large numbers of things, with the need for precision. = Integers
.
Others might refer to integer numbers as Ordinal numbers....i.e. counting numbers.
 
When you first study integers and floating point it appears that floating point has a much wider range but be careful. Compare a micrometer with the odometer on your car. The odometer shows much higher values but the incremental values of tenths of a mile (US) are much larger than the micrometer. In other words a floating point can represent a bigger range by leaving out a lot of in between values - especially in very large numbers. In a PLC try repeatedly adding 1.0 to a floating point value. After a while you will notice no change when the increment between floating point representations becomes more than 1.
So in short, integers are for counting floats are for measuring.
 
So in short, integers are for counting floats are for measuring.

However, the data from analog input cards (and data to analog output cards) is often in integer form (some integer value between -32767 and 32767), though it can certainly be beneficial during programming to scale it to a floating point number (-10.0 to +10.0).

Use integers when the precision you need is exactly 1 (i.e. counting), and use floats for precision smaller than 1, or for large numbers, where precision doesn't have to be down to a single count.
 

Similar Topics

hello eveyrone I want to make an application with M221 PLC in SOMACHINE BASIC program. I request your valuable help. I have a 50 ms pulse...
Replies
1
Views
1,584
Hi all, I have a noob question regarding data handling from sensors. I understand configurations and I/O mapping sensor input/output variables...
Replies
2
Views
197
Hello I am new here and new to PLC's, I wrote this program for a class that I am taking and my local tech school. The description is switch 7 will...
Replies
0
Views
392
Hello I am new here and new to PLC's, I wrote this program for a class that I am taking and my local tech school. The description is switch 7 will...
Replies
10
Views
1,907
I’m a bit stuck on HMI (KTP-1200) programming… See the picture attached. The PASS or FAIL box should only appear when the toggle switch is...
Replies
7
Views
1,010
Back
Top Bottom