Funny -0

by Bushmills

Version 1 (December 17, 2020)

Download (46 downloads)

I couldn't find a category "problems" to post this in, so I put it into the next best match. It appears that Automate has a problem with dealing with the numeric value of zero, as it distinguishes between 0 and -0. I ran into this problem when trying to use all-ones true flags, with expressions like -(a = b) (meant to keep zeroes, but convert 1 to -1). Strangely enough, many of my comparisons gave rather odd results, such as "not false" not being "true". I traced down the problem to my prepending of a dash for obtaining the negative values, which works in most cases, but not for the special case of 0.
My workaround for the time being is to two-complement the number instead, as in ~(expr)+1

Arena Closer, thanks for commenting - the leading "+" aren't meant to turn the zero positive, but to make sure that I do numeric comparison rather than string comparison.
The otherwise identical flows are meant to show that regardless of whether or how I force numbers, the difference between 0 and -0 remains.

4.0 average rating from 2 reviews

5 stars
0
4 stars
2
3 stars
0
2 stars
0
1 star
0
Reports
0

Rate and review within the app in the Community section.