Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsComparing negative values
https://www.eclipse.org/forums/index.php/mv/msg/1102427/1821470/#msg_1821470
Can somebody give me a hint on how to check negative values to see if they are equal?
In my current application I have used an EQ block from the iec library. It works fine for positive values, but I soon realised that this is not true for negative values.
Casting the value to a dword does also not help as seen in the screenshot.
Is this behaviour expected and what would my alternative be?
Thank you in advance!]]>Mario Krizic2020-02-13T13:16:44-00:00Re: Comparing negative values
https://www.eclipse.org/forums/index.php/mv/msg/1102427/1821477/#msg_1821477
based on this very small snippet and the values I can see there, I would guess you are not using signed data types. How are your EQ ins typed (e.g., what are they connected with)
Best regards,
Martin]]>Martin Melik Merkumians2020-02-13T14:10:11-00:00Re: Comparing negative values
https://www.eclipse.org/forums/index.php/mv/msg/1102427/1821484/#msg_1821484
Originally the values were INTs converted to DWORDs, so I tried changing the values to INT when I realised they are not the same size. This is probably converted to DINT I cannot tell exactly as I have tried out some things in the meantime, but it does not work either.
One is connected to the input data of my custom FB and the other is the read value from a ID block.]]>Mario Krizic2020-02-13T14:54:43-00:00Re: Comparing negative values
https://www.eclipse.org/forums/index.php/mv/msg/1102427/1821485/#msg_1821485
Alois Zoitl2020-02-13T14:59:21-00:00Re: Comparing negative values
https://www.eclipse.org/forums/index.php/mv/msg/1102427/1821486/#msg_1821486
I have provided a screenshot of my current test application. I hope this helps. ]]>Mario Krizic2020-02-13T15:07:02-00:00Re: Comparing negative values
https://www.eclipse.org/forums/index.php/mv/msg/1102427/1821487/#msg_1821487
there is no screenshot attached]]>Martin Melik Merkumians2020-02-13T15:10:55-00:00Re: Comparing negative values
https://www.eclipse.org/forums/index.php/mv/msg/1102427/1821489/#msg_1821489
Mario Krizic2020-02-13T15:15:18-00:00Re: Comparing negative values
https://www.eclipse.org/forums/index.php/mv/msg/1102427/1821490/#msg_1821490
Martin Melik Merkumians2020-02-13T15:16:48-00:00Re: Comparing negative values
https://www.eclipse.org/forums/index.php/mv/msg/1102427/1821492/#msg_1821492
Mario Krizic2020-02-13T15:20:36-00:00Re: Comparing negative values
https://www.eclipse.org/forums/index.php/mv/msg/1102427/1821493/#msg_1821493
Martin Melik Merkumians2020-02-13T15:20:47-00:00Re: Comparing negative values
https://www.eclipse.org/forums/index.php/mv/msg/1102427/1821494/#msg_1821494
Martin Melik Merkumians2020-02-13T15:21:34-00:00Re: Comparing negative values
https://www.eclipse.org/forums/index.php/mv/msg/1102427/1821495/#msg_1821495
After changing the types I ran the program again and you can see that the EQ block outputs false only when comparing negative values. Thoughts?]]>Mario Krizic2020-02-13T15:32:19-00:00Re: Comparing negative values
https://www.eclipse.org/forums/index.php/mv/msg/1102427/1821499/#msg_1821499
seems like a bug. I will check this on my machine]]>Martin Melik Merkumians2020-02-13T16:06:57-00:00Re: Comparing negative values
https://www.eclipse.org/forums/index.php/mv/msg/1102427/1821889/#msg_1821889
Mario Krizic2020-02-21T15:52:29-00:00