From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=43689 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OwBTq-00049q-S3 for qemu-devel@nongnu.org; Thu, 16 Sep 2010 06:14:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OwBTl-0002FB-0I for qemu-devel@nongnu.org; Thu, 16 Sep 2010 06:14:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14931) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OwBTk-0002F6-PT for qemu-devel@nongnu.org; Thu, 16 Sep 2010 06:14:08 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o8GAE86d018095 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 16 Sep 2010 06:14:08 -0400 Message-ID: <4C91EDEE.7010008@redhat.com> Date: Thu, 16 Sep 2010 12:14:06 +0200 From: Jes Sorensen 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> <4C91C4F1.1010501@redhat.com> In-Reply-To: <4C91C4F1.1010501@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 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: Paolo Bonzini Cc: quintela@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com On 09/16/10 09:19, Paolo Bonzini wrote: > On 09/15/2010 09:31 PM, Jes Sorensen wrote: >> Floating point is just plain wrong. If someone wants to do something >> like in your example they really ask for an error. > > An error, not an overflow. > > Adding overflow checking on top of your patch is also fine. Another > possibility is to look ahead for the multiplier so that you correctly > base the divider and do everything in 64.64 fixed point. But it seems > overkill compared to floating-point, whose 53-bit mantissa precision > will almost always lead to exact results (large numbers usually have a > lot of zeros at the end, both in binary and in decimal). I think it would be quite reasonable not to accept anything more than say 3-4 decimal points, since there are the t/g/m/k options as well. Cheers, Jes