Qt: Roundoff of 12.625 by 2 returns 12.62
问题 I can't get it why the ff code returns 12.62 instead of 12.63 QDebug << QString::number(12.625, 'f', 2); and also what will be the solution for this? Currently my solution is this QDebug << QString::number(12.625 + 0.0001, 'f', 2); and it will return 12.63 . btw my OS is ubuntu 11.04 回答1: GCC uses "Round to Even" or "Banker's Rounding" as it's default mode while Visual Studio uses "Round away from Zero" From the GCC docs: Rounding This is the default mode. It should be used unless there is a