Hello,
I have problems to understand what is happening in a simple test on teensy 3.2 board.
I simply multiplied 4 double constants and the result is not what I expected.
The printed result in monitor is 28639999.39 instead of 28640000
Could you help me to understand what is wrong with my code?
I have problems to understand what is happening in a simple test on teensy 3.2 board.
I simply multiplied 4 double constants and the result is not what I expected.
Code:
const double beltRatio = 10.0;
const double frictionRatio = 35.8;
const double stepsNumber = 1000.0;
const double microSteps = 80.0;
double totalMicrostepsNumber = 0.0;
void setup() {
totalMicrostepsNumber=stepsNumber * microSteps * beltRatio * frictionRatio;
}
void loop() {
Serial.println(totalMicrostepsNumber);
delay(1000);
}
The printed result in monitor is 28639999.39 instead of 28640000
Could you help me to understand what is wrong with my code?