[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] utils: Reduce chance of rounding inaccuracy in qemu_strtosz.
From: |
Eric Blake |
Subject: |
Re: [PATCH] utils: Reduce chance of rounding inaccuracy in qemu_strtosz. |
Date: |
Mon, 15 Mar 2021 13:07:56 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 |
On 3/15/21 8:18 AM, Richard Henderson wrote:
> On 3/15/21 5:33 AM, Eric Blake wrote:
>> On 3/13/21 3:48 PM, Richard Henderson wrote:
>>> On 3/11/21 2:07 PM, Eric Blake wrote:
>>>> + /*
>>>> + * Add in a fudge-factor (2^53 when double is IEEE format) for
>>>> + * all scales less than P (2^50), so that things like
>>>> + * 12.345M with unit 1000 produce 12345000 instead of
>>>> + * 12344999.
>>>> + */
>>>> + if (mul > 1e49) {
>>>
>>> The comment says less than, the code says greater than.
>>
>> Shoot. A demonstration that I did not have an environment that actually
>> reproduced the bug
>
> Any i686 vm will do. I had a debian 10 vm hanging around in which I
> could reproduce it.
Anyways, I've now got a gitlab CI running, and even with my patch
corrected, it still failed in a different spot:
https://gitlab.com/ebblake/qemu/-/jobs/1099334550
ERROR:../tests/unit/test-cutils.c:2096:test_qemu_strtosz_units:
assertion failed (res == EiB): (1152921504606847232 == 1152921504606846976)
so I'm liking your patch in lieu of mine.
https://lists.gnu.org/archive/html/qemu-devel/2021-03/msg05290.html
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org