Same program, designed to demonstrate overflow of integer variable during calculation, gives different results on Arduino UNO and nodeMCU 0.9.
Hardware
Hardware: nodeMCU 0.9
Core Version: 2.2.0
Description
The attached program is intended to show how calculations where intermediate results exceed the size of the result variable will cause overflow and unexpected results.
On the Arduino Uno, the program output is:
x = 27
y = 27
z = 27
On the nodeMCU, the output is:
x = 27
y = 1626
z = 1626
In the second and third calculations, the intermediate value of 200,000 is not overflowing.
Basic Infos
Same program, designed to demonstrate overflow of integer variable during calculation, gives different results on Arduino UNO and nodeMCU 0.9.
Hardware
Hardware: nodeMCU 0.9 Core Version: 2.2.0
Description
The attached program is intended to show how calculations where intermediate results exceed the size of the result variable will cause overflow and unexpected results.
On the Arduino Uno, the program output is:
On the nodeMCU, the output is:
In the second and third calculations, the intermediate value of 200,000 is not overflowing.
Settings in IDE
Module: NodeMCU 0.9 (ESP-12 module) Flash Size: 4M (3M SPIFFS) CPU Frequency: 80Mhz
Sketch