tft.drawFloat confusion

Hi

I am using the following.

1.TFT library by Bodmer

2.Arduino 1.8.5

I am not sure what causes the problem ,

The library (dont think so)

Arduino 1.8.5 version (not sure)

Me (most likely)

1234 prints to the tft screen.(use tft.drawNumber)

1.234 also prints to the screen.(use tft.drawFloat)

5/1000 prints zero's...-0.000

void loop()
{
int Analog_0 = 0;  
float Value1 = 0;
float Value2 = 0;
float Value3 = 0;
  
Analog_0 = analogRead(A0);
tft.drawNumber(Analog_0,0,0,2);//Print 1023 on screen...work ok

Value1 = 1.234;                
tft.drawFloat(Value1,3,0,20,2);//Print 1.234 on screen...work ok

Value2 = (50/10);
tft.drawFloat(Value2,3,0,40,2);// Print 5.000...ok

Value2 = Value2/10;
tft.drawFloat(Value2,3,0,60,2);//Print 0.500...ok

Value2 = Value2/10;
tft.drawFloat(Value2,3,0,80,2);// print0.050...ok

Value2 = Value2/10;
tft.drawFloat(Value2,3,0,100,2);// Print 0.005...ok

Value3 = (50/1000);
tft.drawFloat(Value3,3,60,0,2);//Prints -0.000 ...Wrong!!!!!

delay(1000);
 
}

Please help ,what am I doing wrong?

Hello! Please copy the output of what happens in your black colored bow on the bottom of the Arduino Screen after the program is run and paste it here.

5/1000 uses integer arithmetic, even if you are storing the result in a float. The compiler doesn't look ahead. It evaluates 5/1000 (equals 0 in integer math) and then it looks at the type of the variable on the left of the assignment operator.

Try...

Value2 = (float)5 / 1000;

Or...

Value2 = 5.0 / 1000;