From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark H Weaver Subject: Re: [PATCH] build: Fix potential type error when generating human-friendly byte count strings. Date: Wed, 09 Sep 2015 22:42:55 -0400 Message-ID: <87a8svuh8w.fsf@netris.org> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40342) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZrqF-00076H-M2 for guix-devel@gnu.org; Wed, 09 Sep 2015 22:44:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZrqC-00062L-En for guix-devel@gnu.org; Wed, 09 Sep 2015 22:44:03 -0400 Received: from world.peace.net ([50.252.239.5]:39926) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZrqC-000612-By for guix-devel@gnu.org; Wed, 09 Sep 2015 22:44:00 -0400 In-Reply-To: (Steve Sprang's message of "Wed, 9 Sep 2015 14:05:35 -0700") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Steve Sprang Cc: guix-devel@gnu.org Steve Sprang writes: > This is a follow up tweak to my previous "progress bar" patch. With a > really slow throughput it's possible to get fractional sub-KiB byte > counts, so I added some additional number massaging. Sounds good! Looks good to me except for a few minor nits on this auxiliary procedure: > +(define (number->integer n) > + "Given an arbitrary number N, round it and return the exact result." > + (inexact->exact (round n))) How about calling it "nearest-exact-integer"? Also, it makes sense only for real numbers, not arbitrary numbers, and the variable name N is conventionally used to denote natural numbers, and X for real numbers. So, how about naming the argument 'x', and using something closer to the following docstring: "Given a real number X, return the nearest exact integer, with ties going to the nearest exact even integer." Otherwise, looks good to me. Can you send an updated patch? Mark