* Re: [Qemu-devel] [PATCH v6 4/7] qapi: String visitor, use %f representation for floats
[not found] ` <1335796410-8646-1-git-send-email-mdroth@linux.vnet.ibm.com>
@ 2012-05-01 21:45 ` Andreas Färber
0 siblings, 0 replies; only message in thread
From: Andreas Färber @ 2012-05-01 21:45 UTC (permalink / raw)
To: Michael Roth; +Cc: pbonzini, aliguori, qemu-devel
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 <mdroth@linux.vnet.ibm.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
/-F
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-05-01 21:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <4F9C18DF.6030904@suse.de>
[not found] ` <1335796410-8646-1-git-send-email-mdroth@linux.vnet.ibm.com>
2012-05-01 21:45 ` [Qemu-devel] [PATCH v6 4/7] qapi: String visitor, use %f representation for floats Andreas Färber
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).