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:
parent
50df6e9824
commit
73ac4cdc3f
@ -1422,7 +1422,7 @@ truncate_string(BString& string, uint32 mode, float width,
|
|||||||
{
|
{
|
||||||
// add a tiny amount to the width to make floating point inaccuracy
|
// add a tiny amount to the width to make floating point inaccuracy
|
||||||
// not drop chars that would actually fit exactly
|
// not drop chars that would actually fit exactly
|
||||||
width += 0.00001;
|
width += 1.f / 128;
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case B_TRUNCATE_BEGINNING:
|
case B_TRUNCATE_BEGINNING:
|
||||||
|
Loading…
Reference in New Issue
Block a user