I'm currently doing some data acquisition with my arduino and I recently had some drawback with some of my functions.
I found out that my arduino won't compute division. I uploaded an easy program like:
void setup(){
Serial.begin(9600);
}
long result;
long test;
void loop(){
result = 1 / 2;
test = 0.01 * 528;
delay(1000);
Serial.println(result,DEC);
Serial.println(test,DEC);
}
The result is alway 0, and the multiplication result is 5. Is something wrong with the FPU ? As far as I know, I don't need to include anything to do basic float operation...
Well, it seems like I need to get schooled again; I tough floating point operation where (always?) done by an FPU, or equivalent and bitwise-int operation by ALU.
"FPU" is done with code on a general 8 bit processor
Which is why one should avoid using floats unless there is a real need for them that can't be accomplished with int and longs. It takes cost in cycles and memory resources.