From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=42700 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OwCLV-000110-Op for qemu-devel@nongnu.org; Thu, 16 Sep 2010 07:09:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OwCLU-0002H6-57 for qemu-devel@nongnu.org; Thu, 16 Sep 2010 07:09:41 -0400 Received: from mail-vw0-f45.google.com ([209.85.212.45]:58283) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OwCLU-0002Gm-30 for qemu-devel@nongnu.org; Thu, 16 Sep 2010 07:09:40 -0400 Received: by vws19 with SMTP id 19so986080vws.4 for ; Thu, 16 Sep 2010 04:09:38 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4C91FAED.5000903@redhat.com> Date: Thu, 16 Sep 2010 13:09:33 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1284553440-17985-1-git-send-email-Jes.Sorensen@redhat.com> <1284553440-17985-3-git-send-email-Jes.Sorensen@redhat.com> <4C90EA14.7040801@redhat.com> <4C911EFE.2020504@redhat.com> <4C91F400.4020101@redhat.com> <4C91F47F.6020800@redhat.com> In-Reply-To: <4C91F47F.6020800@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 2/5] Support human unit formats in strtobytes, eg. 1.0G List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jes Sorensen Cc: armbru@redhat.com, quintela@redhat.com, Avi Kivity , qemu-devel@nongnu.org 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