A problem of losing accuracy of float Division in QT

the following program running environment QT MinGW 5.3.0 32 bit

Code one:

QString s="2.08";
float b=s.toFloat();
qDebug()<<b;               //2.08
float c=0.01;
float val=b/c;
int value=(int)val;   
qDebug()<<value;        //207    error

Code 2:

QString s="2.08";
float b=s.toFloat();
qDebug()<<b;            //2.08
float c=0.01;
float val=b/c;
qDebug()<<val;        //208  
int value=(int)val;  
qDebug()<<value;      //208   ok

Code 3:

float b=2.08;             //
qDebug()<<b;            //2.08
float c=0.01;
float val=b/c;
int value=(int)val;  
qDebug()<<value;      //208   ok

Thank you very much for looking for a sensible person to help solve your doubts.

Qt5
Dec.19,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3a187-2c1f2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3a187-2c1f2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?