4/8/2024 2:54 PM | |
Joined: 7/7/2010 Last visit: 6/7/2024 Posts: 14771 Rating: (2378)
|
You can even divide by -1 (or -1.0). I imagine there's an extremely fast XOR-based calculation available to force the sign bit. Here's some stackoverflow efforts to determine efficient ways to negate a number. Strangely, your method was not analyzed. flash - Fastest way to make Negative numbers - Stack Overflow How about #intValue *= -1; (obtuse with same results) There are plenty of bad ways that would not meet the Siemens S7-1200/1500 Programming and Style Guidelines, like setting the sign bit in code.
|
Last edited by: 0_Einstein at: 04/09/2024 19:53:17removed invalid suggestion science guy |
|
Follow us on