qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] Re: [PATCH 2/5] Support human unit formats in strtobytes, e


From: Paolo Bonzini
Subject: [Qemu-devel] Re: [PATCH 2/5] Support human unit formats in strtobytes, eg. 1.0G
Date: Thu, 16 Sep 2010 13:09:33 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.3 Thunderbird/3.0.5

On 09/16/2010 12:42 PM, Jes Sorensen wrote:
On 09/16/10 12:40, Avi Kivity wrote:
  On 09/15/2010 09:31 PM, Jes Sorensen wrote:
Floating point is just plain wrong.

Why?  If command-line processing becomes too slow, you can always buy a
math co-processor.

Because it's imprecise anyway

As Avi mentioned, this is only true if you need byte precision beyond 4 PB. But most of the time byte precision is not necessary so in practice floating-point will be indistinguishable: all exact powers of 10 up to 10^22 (beyond 64-bits) can be represented correctly by an IEEE double.

There's also strtold, if you're worried about precision...

Besides, most users will probably hit their shell command line limit
before hitting the problem with the decimals.

Value is first shifted and then multiplied, so that 6-7 digits may already overflow if the unit is terabytes.

Paolo



reply via email to

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