Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched.
Close
rounding up a value is simpler with round from the oscat lib.
it is more predictable, and the way it should be done.
you are doing a trick and suppose the conversion is good, but a real is totally different from a word.
the biggest problem is you do not know how 3 is declared as a byte or as a word or anything.
so make all variables declared this way the result is predicatable.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When ever am using this in program, it is supposed to round up the value and give answer
eg:Lreal_to_dword(in:=(3/5))
answer to this is supposed to be 1 but some how in my program it is zero,Can any help me on this
Thanks
Sarath
Maybe (3/5) is handled as an integer first. Which results in 0.
Try it with a variable like:
rounding up a value is simpler with round from the oscat lib.
it is more predictable, and the way it should be done.
you are doing a trick and suppose the conversion is good, but a real is totally different from a word.
the biggest problem is you do not know how 3 is declared as a byte or as a word or anything.
so make all variables declared this way the result is predicatable.
Yes declaring it as integer is the problem.
Actually i do not need decimal points thats y i tried this conversion
Thank u