Executing the following code always gives -511 as a result, I performed many tests, and it seems that results are correct from 0 * 0 to 181 * 181, beyond that, results are abnormal, I tried many types for the z variable (int, long, float) without success, any idea? I'm using the Arduino Uno.
long z = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
z = 255 * 255;
Serial.println(z);
delay(200);
}
float z = 1 / 5
result will be0
because integer division results with integer that is later casted to float.