qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>, berrange@redhat.com
Subject: Re: [PATCH] utils: Reduce chance of rounding inaccuracy in qemu_strtosz.
Date: Mon, 15 Mar 2021 13:07:56 -0500	[thread overview]
Message-ID: <12ec16ee-fdf3-e3ef-d52e-540f744e8c40@redhat.com> (raw)
In-Reply-To: <8dd4a71a-7fe9-a6c3-290d-81adf5c53a4d@linaro.org>

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



  reply	other threads:[~2021-03-15 18:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 20:07 [PATCH] utils: Reduce chance of rounding inaccuracy in qemu_strtosz Eric Blake
2021-03-13 21:48 ` Richard Henderson
2021-03-15 11:33   ` Eric Blake
2021-03-15 13:18     ` Richard Henderson
2021-03-15 18:07       ` Eric Blake [this message]
2021-03-15 11:28 ` Daniel P. Berrangé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12ec16ee-fdf3-e3ef-d52e-540f744e8c40@redhat.com \
    --to=eblake@redhat.com \
    --cc=berrange@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).