View Single Post
Old January 7th, 2020, 10:22 AM   #24
Lifetime Supporting Member
United States

drbitboy is offline
drbitboy's Avatar
Join Date: Dec 2019
Location: Rochester, NY
Posts: 804
Wink And the beat goes on

Originally Posted by GaryS View Post
In fact to copy (Not Move) a float to an integer requires the result to be placed in 2 consecutive integers one for the whole number part and one for the decimal number.
Okay, I had some fun with you in the previous post, but the bold italics bit above is flat-out wrong; so I am highlighting that for any poor soul who stumbles onto this thread in the future.

In the image below, I have copied (via the CPW command; COP does not work on MicroLogix) the bits of two 16-bit INTEGERs, 16512 and -32768 (F080H and 8000H) to a REAL, and the resulting REAL is 4.015625. It should be obvious that neither 16512 nor -32768 are either of 4 (the whole number) or 0.015625 (the decimal number), although together, but in a more complex way, the bits in those two INTEGERs do make up the bits in the REAL. Cf. here, specifically this

Last edited by drbitboy; January 7th, 2020 at 10:35 AM. Reason: add links
  Reply With Quote