@VRonin said in qRound() in Qt:
I thought error of double was always in defect
No not necessarily. Depends on the number you are trying to represent. Consider 2/3 in decimal floating point (opposed to the binary used in computers, just for simplicity) as an example, that'd give you 0.6(6..)7 as the last digit would be rounded up if you use round-to-nearest. Same consideration applies for binary digits. The usual floating point's fraction is represented, as is known (ignoring all the normalizations and such), as the sum:
Number = Sum(i_k / 2^k)
Where i_k is the k-th binary digit (either 0 or 1) and 2^k is the k-th power of 2. Same as with the decimal case, except the base is 2. Then the question becomes whether the after-the-last representable digit is rounded up or down. That's why one says that sqrt is accurate to 0.5 epsilons, as the actual calculation is performed in extended precision and then the result is rounded to the representable double type. This means the error from rounding is bound by half an epsilon - i.e. whether it was rounded up or down.