truncate_string(): Be a lot laxer wrt. rounding incaccuracies

Instead of 1/10000 we now add 1/128 to the width to compensate for
rounding inaccuracies. Due to the limited float mantissa precision
(23 bit) the previous value would already have no effect for relatively
small widths (>= 128).

Fixes #10455.
This commit is contained in:
Ingo Weinhold 2014-01-27 16:28:07 +01:00
parent 50df6e9824
commit 73ac4cdc3f
1 changed files with 1 additions and 1 deletions

View File

@ -1422,7 +1422,7 @@ truncate_string(BString& string, uint32 mode, float width,
{
// add a tiny amount to the width to make floating point inaccuracy
// not drop chars that would actually fit exactly
width += 0.00001;
width += 1.f / 128;
switch (mode) {
case B_TRUNCATE_BEGINNING: