Integer division in ICE


Dividing an integer N by itself doesn’t always give you 1.
IntegerDivision1
I think it’s a problem in the Divide by Scalar node (the division is probably returning a scalar like 0.99999999, and then that is truncated to zero when it is converted to an integer).

A workaround is to do all your division with scalars, and then use modulo to determine whether you Round or Floor the result. Here’s an example compound by Guillaume Laforge:
IntegerDivisionCompound

IntegerDivision3

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s