729194496 B = 695.4 MB
2x695.4 MB = 145838898 B = 1.35 GB
1 GB = 2^30 B = 1073741824 B
and now
qint64 size = file.size(); // 729194496 B
size += size; // 145838898 B
double z = size/1073741824;
str
= QString::number( z,
'f',
2 );
// 1.00 ( WRONG )str.sprint("%.2f", z ); //1.00
int x = floor( z ); // x = 1, qRound( z ) = 1 ( GOOD )
int y = floor( (z - x )*100 ); // y=0 ( WRONG )
QFileInfo file("movie.avi");
qint64 size = file.size(); // 729194496 B
size += size; // 145838898 B
double z = size/1073741824;
QString str;
str = QString::number( z, 'f', 2 ); // 1.00 ( WRONG )
str.sprint("%.2f", z ); //1.00
int x = floor( z ); // x = 1, qRound( z ) = 1 ( GOOD )
int y = floor( (z - x )*100 ); // y=0 ( WRONG )
str = QString::number(x)+"."+QString::number(y); //1.00 ( WRONG )
To copy to clipboard, switch view to plain text mode
So, how can i get 1.35 GB ?
Bookmarks