0

I am writing my code in codesys in CFC Language and performing multiplication and store the answer in variable of LREAL data type. My issue is when the answer comes negative it still shows positive answer. I looked to solve the problem by changing the data type of resulted variable but i am unable to find Float data type in CFC language.

Please help me as I am stucked in it. Awaiting for kind replies.

TIA

Mar_60
  • 13
  • 3
  • All data types in codesys can hold negative values, except for TIME or LTIME, and types starting with '**U**', like **U**INT (U stands for Unsigned). So LREAL can hold negative values, in fact it can hold numbers betweeen [-1.7976931348623158e+308 and 1.7976931348623158e+308](https://help.codesys.com/api-content/2/codesys/3.5.13.0/en/_cds_datatype_real/) – Guiorgy Apr 07 '21 at 09:04
  • My answer is -45 but it is calculating 45. While i am keeping my storing variable data type LREAL – Mar_60 Apr 07 '21 at 09:28
  • 2
    Then the problem must be in the calculation algorithm – Guiorgy Apr 07 '21 at 09:36
  • 2
    Edit the question to provide a [mre]. – Eric Postpischil Apr 07 '21 at 10:43

0 Answers0