[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v6 4/7] qapi: String visitor, use %f representat

From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH v6 4/7] qapi: String visitor, use %f representation for floats
Date: Tue, 01 May 2012 23:45:44 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120421 Thunderbird/12.0

Am 30.04.2012 16:33, schrieb Michael Roth:
> Currently string-output-visitor formats floats as %g, which is nice in
> that trailing 0's are automatically truncated, but otherwise this causes
> some issues:
>  - it uses 6 significant figures instead of 6 decimal places, which
>    means something like 155777.5 (which even has an exact floating point
>    representation) will be rounded to 155778 when converted to a string.
>  - output will be presented in scientific notation when the normalized
>    form requires a 10^x multiplier. Not a huge deal, but arguably less
>    readable for command-line arguments.
>  - due to using scientific notation for numbers requiring more than 6
>    significant figures, instead of hard-defined decimal places, it
>    fails a lot of the test-visitor-serialization unit tests for floats.
> Instead, let's just use %f, which is what the QJSON and the QMP visitors
> use.
> Signed-off-by: Michael Roth <address@hidden>

Reviewed-by: Andreas Färber <address@hidden>


SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

reply via email to

[Prev in Thread] Current Thread [Next in Thread]