Skip to main content
ShelLuser
Inspiring
August 30, 2022

Possible bug: -15 > 10 in value processor?

  • August 30, 2022
  • 2 replies
  • 180 views

Hi gang,

I'm diving into functions and I think I've discovered a bug with the comparison routine:

So the greater than compares "a > b", so in this case it tells us that -15 is higher than 10. Because the outcome of this is -15, not the expected 5. Proof of concept graph is attached. The moment I instance this I get -15.

 

Also tried to re-start Designer, the moment I open it again and load my package.. -15. 

 

Finally: still somewhat new to functions (but digging in quite deep ;)) I also set up a scene where I didn't re-use the -15 integer: same results. I suspect a bug, can someone reproduce?

 

Thanks for reading & any possible feedback!

2 replies

ShelLuser
ShelLuserAuthor
Inspiring
August 31, 2022

Thanks for your comment, appreciate it!

 

A peculiar issue indeed because I would assume that the least they'd use is 8 bit values, this would imply that integers should be usable up to -128 and 128.

 

Either way, a bug this may be; it's also an interesting challenge: I'm looking into building a function to overcome this limitation. Should be doable; everything can be instanced, so...  but that's for later 😉

davescm
Community Expert
Community Expert
August 31, 2022

The problem is with the comparison node (in this case 'Greater' but it affects others). Negative integers come out greater than positive integers. It appears to be comparing the signed values in bits and not correctly using the sign bit.  

If you use Floats instead of integers then the comparison nodes work correctly with negative values.

 

However - be aware that simply using a cast node to cast the integers to float does not work correctly with negative numbers, so you would need to start with float values, or use positive integers and a separate sign so that you can multiply the output of cast to float by -1.

 

I don't work for Adobe so cannot comment on any fixes that may be in hand for these issues.

 

Dave