Why do cast to (long) in this scenario?

So we have to use this, below:

scaledValue = voltValue * deltaY / deltaX;

in order to scale an analog value but the value was erratic so we then use:

scaledValue = (long) voltValue * deltaY / deltaX;

Why do we need to use casting in this scenario? Is it due to the order of which BODMAS is carried out???

Touch here for the full post on the Arduino Apprentices tumblr

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s