A possibly stupid question, but I don't understand.
Take this piece of code:
float poo1( 0.1 );
poo1 = poo1 - 0.1;
double poo2( 0.1 );
poo2 = poo2 - 0.1;
QMessageBox::information( 0,
"Help",
QString("Float : %1\nDouble : %2").
arg( poo1
).
arg( poo2
) );
float poo1( 0.1 );
poo1 = poo1 - 0.1;
double poo2( 0.1 );
poo2 = poo2 - 0.1;
QMessageBox::information( 0, "Help", QString("Float : %1\nDouble : %2").arg( poo1 ).arg( poo2 ) );
To copy to clipboard, switch view to plain text mode
poo1 will return 1.49012e-09
poo2 will return 0
Why is that? Shouldn't they both be zero?
Thanks,
Royce
Bookmarks