Quote:
Originally Posted by GaryS
This may sound strange but try it using all real numbers
I remember reading someplace a while back that you should never mix int and real numbers math functions in a plc
It has to do with the they are handled in a plc it is different then in a computer or calculator

The original calculation used only integers, no mixing, but the result was off: the MUL of two
ODD 16bit INTEGERs was an
EVEN INTEGER product.
The problem appears to be that it is not the program, but it is the
EMULATOR that is MOVing INTEGERs into REALs, doing the multiply in REALs, and MOVing the REAL product back the an INTEGER result, which MOVe drops any
LSBits after the first 24 MSBits, when in fact the most important part of the result is the 15 LSBITs.
The odd thing is that I cannot imagine that the emulator, whether written in C, Fortran, assembler or anything else, would have any trouble whatsoever multiplying two 16bit integers and getting the correct result, so this is a design decision, perhaps to keep the freelyavailable emulator from being of any commercial use.
Hah, it would be funny, and not incredibly difficult, to go in and modify the binary emulator .EXE file to do it correctly.