From unknown Sun Jun 22 04:15:03 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#56558] [PATCH] build: Simpler percentage calculation. Resent-From: raingloom Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 14 Jul 2022 15:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 56558 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56558@debbugs.gnu.org Cc: raingloom X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.165781079217008 (code B ref -1); Thu, 14 Jul 2022 15:00:02 +0000 Received: (at submit) by debbugs.gnu.org; 14 Jul 2022 14:59:52 +0000 Received: from localhost ([127.0.0.1]:38592 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oC0Jk-0004QG-1S for submit@debbugs.gnu.org; Thu, 14 Jul 2022 10:59:52 -0400 Received: from lists.gnu.org ([209.51.188.17]:41692) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oC0Ji-0004Q8-MQ for submit@debbugs.gnu.org; Thu, 14 Jul 2022 10:59:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oC0Ji-0004tf-Gt for guix-patches@gnu.org; Thu, 14 Jul 2022 10:59:50 -0400 Received: from mx1.riseup.net ([198.252.153.129]:43340) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oC0Jg-0007Gw-5a for guix-patches@gnu.org; Thu, 14 Jul 2022 10:59:49 -0400 Received: from fews2.riseup.net (fews2-pn.riseup.net [10.0.1.84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.riseup.net", Issuer "R3" (not verified)) by mx1.riseup.net (Postfix) with ESMTPS id 4LkHhf4gmWzDrXX for ; Thu, 14 Jul 2022 14:59:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1657810786; bh=fzL9MmKZHjHsWw4Fn0rJKtE7sxgm70HQBtuIXcqsJrE=; h=From:To:Cc:Subject:Date:From; b=EaVH86Kz2TifawsODaR4BeakiKmnR5xz1Fg8sFY84mCh8RHfhz6W2sECxbpY9Vzoy 6rqNvKNXMEahvKYASZOGZO7fJrcuiTyHvkwDR+h4DhxDjkaLYcw4UrNMbxK/XEFYWO DNCXSW4Y/CX6DNuNdZnrvQZnQBpCLONGbLRRgdUg= X-Riseup-User-ID: 71A3002FE9AA57555A6479D41E0659D74EA13E83245BBAF331A4CB3FBC896A76 Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews2.riseup.net (Postfix) with ESMTPSA id 4LkHhd5JxCz214c; Thu, 14 Jul 2022 14:59:45 +0000 (UTC) From: raingloom Date: Thu, 14 Jul 2022 16:58:51 +0200 Message-Id: <20220714145851.20305-1-raingloom@riseup.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=198.252.153.129; envelope-from=raingloom@riseup.net; helo=mx1.riseup.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) * build-aux/compile-all (%): Simpler calculation that avoids intermediate float. --- build-aux/compile-all.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-aux/compile-all.scm b/build-aux/compile-all.scm index 9ffbce43ad..6fdbe0dea8 100644 --- a/build-aux/compile-all.scm +++ b/build-aux/compile-all.scm @@ -89,7 +89,7 @@ (define (parallel-job-count*) (define (% completed total) "Return the completion percentage of COMPLETED over TOTAL as an integer." - (inexact->exact (round (* 100. (/ completed total))))) + (quotient (* 100 completed) total)) ;; Install a SIGINT handler to give unwind handlers in 'compile-file' an ;; opportunity to run upon SIGINT and to remove temporary output files. -- 2.37.0 From unknown Sun Jun 22 04:15:03 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#56558] [PATCH] build: Simpler percentage calculation. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 15 Jul 2022 08:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56558 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: raingloom , 56558@debbugs.gnu.org Received: via spool by 56558-submit@debbugs.gnu.org id=B56558.165787334125979 (code B ref 56558); Fri, 15 Jul 2022 08:23:02 +0000 Received: (at 56558) by debbugs.gnu.org; 15 Jul 2022 08:22:21 +0000 Received: from localhost ([127.0.0.1]:39329 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oCGaa-0006kx-Mr for submit@debbugs.gnu.org; Fri, 15 Jul 2022 04:22:20 -0400 Received: from mailrelay.tugraz.at ([129.27.2.202]:32215) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oCGaZ-0006kp-4q for 56558@debbugs.gnu.org; Fri, 15 Jul 2022 04:22:19 -0400 Received: from lprikler-laptop.ist.intra (gw.ist.tugraz.at [129.27.202.101]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4LkkqY2Dpqz3wcS; Fri, 15 Jul 2022 10:22:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1657873337; bh=rn8paxiTRjQdqy4WgrUzO/koFANDo1eSLIpdUQsGUVM=; h=Subject:From:To:Date:In-Reply-To:References; b=su/AmzBnEvP+g8AgnSWgnwxhdUZiM/XoFH0SzLcBXTv+dJl+whHeDvRMXlJxhY6C3 EIFutbxRQF+1Ij0TV0zc9CyYKlLs3e9YWf/W5/eqYguoA1A0iEeQN3Xicky6Ra9TtC eo9+b1AmZqOZGmYxKLXhzscGM/wgnDePzk2zbcc8= Message-ID: <4259f9de2b793af8d39647800d6dec0d377f02d5.camel@ist.tugraz.at> From: Liliana Marie Prikler Date: Fri, 15 Jul 2022 10:22:16 +0200 In-Reply-To: <20220714145851.20305-1-raingloom@riseup.net> References: <20220714145851.20305-1-raingloom@riseup.net> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUG-Backscatter-control: waObeELIUl4ypBWmcn/8wQ X-Spam-Scanner: SpamAssassin 3.003001 X-Spam-Score-relay: -1.9 X-Scanned-By: MIMEDefang 2.74 on 129.27.10.116 X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Am Donnerstag, dem 14.07.2022 um 16:58 +0200 schrieb raingloom: > * build-aux/compile-all (%): Simpler calculation that avoids > intermediate float. > --- >  build-aux/compile-all.scm | 2 +- >  1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/build-aux/compile-all.scm b/build-aux/compile-all.scm > index 9ffbce43ad..6fdbe0dea8 100644 > --- a/build-aux/compile-all.scm > +++ b/build-aux/compile-all.scm > @@ -89,7 +89,7 @@ (define (parallel-job-count*) >   >  (define (% completed total) >    "Return the completion percentage of COMPLETED over TOTAL as an > integer." > -  (inexact->exact (round (* 100. (/ completed total))))) > +  (quotient (* 100 completed) total)) I am fairly certain that this changes the semantics of %. Try for example (% 23 24). Cheers From unknown Sun Jun 22 04:15:03 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#56558] [PATCH] build: Simpler percentage calculation. Resent-From: Csepp Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 15 Jul 2022 10:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56558 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Liliana Marie Prikler Cc: 56558@debbugs.gnu.org, raingloom Received: via spool by 56558-submit@debbugs.gnu.org id=B56558.165788062522911 (code B ref 56558); Fri, 15 Jul 2022 10:24:01 +0000 Received: (at 56558) by debbugs.gnu.org; 15 Jul 2022 10:23:45 +0000 Received: from localhost ([127.0.0.1]:39532 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oCIU5-0005xS-0g for submit@debbugs.gnu.org; Fri, 15 Jul 2022 06:23:45 -0400 Received: from mx0.riseup.net ([198.252.153.6]:59404) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oCIU3-0005xE-A7 for 56558@debbugs.gnu.org; Fri, 15 Jul 2022 06:23:44 -0400 Received: from fews2.riseup.net (fews2-pn.riseup.net [10.0.1.84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.riseup.net", Issuer "R3" (not verified)) by mx0.riseup.net (Postfix) with ESMTPS id 4LknWY3n6Dz9tCY; Fri, 15 Jul 2022 10:23:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1657880617; bh=nSteyQ0JF0WEbp5bIrdtIAtODz7eh74uQVjOlUP9P+o=; h=References:From:To:Cc:Subject:Date:In-reply-to:From; b=JEK3fJnwTxu28Krs3fZdhIXgxPDcXOG4+94Kc6SrhZeNHMIhiYs3+wjrRLJEw8WGZ Dk/ggOVb08s5XuS1o5cz89HtAZsAmV1Lh3oLX9qFTjV1V5By4s3N4bGg6PtMLVzvEx 278at7eDnpl/D6KivF0RsQ6rMtB5ZZrnhHZPcoSM= X-Riseup-User-ID: ACB7919E677C17BB42F0FC6273231CF19CC73D277AFCD4C2FF9121B191DEE95E Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews2.riseup.net (Postfix) with ESMTPSA id 4LknWX67ggz20cj; Fri, 15 Jul 2022 10:23:36 +0000 (UTC) References: <20220714145851.20305-1-raingloom@riseup.net> <4259f9de2b793af8d39647800d6dec0d377f02d5.camel@ist.tugraz.at> From: Csepp Date: Fri, 15 Jul 2022 12:17:30 +0200 In-reply-to: <4259f9de2b793af8d39647800d6dec0d377f02d5.camel@ist.tugraz.at> Message-ID: <87pmi6ad3v.fsf@riseup.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Liliana Marie Prikler writes: > Am Donnerstag, dem 14.07.2022 um 16:58 +0200 schrieb raingloom: >> * build-aux/compile-all (%): Simpler calculation that avoids >> intermediate float. >> --- >> =C2=A0build-aux/compile-all.scm | 2 +- >> =C2=A01 file changed, 1 insertion(+), 1 deletion(-) >>=20 >> diff --git a/build-aux/compile-all.scm b/build-aux/compile-all.scm >> index 9ffbce43ad..6fdbe0dea8 100644 >> --- a/build-aux/compile-all.scm >> +++ b/build-aux/compile-all.scm >> @@ -89,7 +89,7 @@ (define (parallel-job-count*) >> =C2=A0 >> =C2=A0(define (% completed total) >> =C2=A0=C2=A0 "Return the completion percentage of COMPLETED over TOTAL a= s an >> integer." >> -=C2=A0 (inexact->exact (round (* 100. (/ completed total))))) >> +=C2=A0 (quotient (* 100 completed) total)) > I am fairly certain that this changes the semantics of %. Try for > example (% 23 24). > > Cheers It rounds down instead of up, which, :shrug:. If that's a deal breaker, feel free to close this. From unknown Sun Jun 22 04:15:03 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#56558] [PATCH] build: Simpler percentage calculation. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 15 Jul 2022 10:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56558 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Csepp Cc: 56558@debbugs.gnu.org Received: via spool by 56558-submit@debbugs.gnu.org id=B56558.165788084623960 (code B ref 56558); Fri, 15 Jul 2022 10:28:02 +0000 Received: (at 56558) by debbugs.gnu.org; 15 Jul 2022 10:27:26 +0000 Received: from localhost ([127.0.0.1]:39547 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oCIXe-0006EO-3s for submit@debbugs.gnu.org; Fri, 15 Jul 2022 06:27:26 -0400 Received: from mailrelay.tugraz.at ([129.27.2.202]:51625) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oCIXb-0006EE-KW for 56558@debbugs.gnu.org; Fri, 15 Jul 2022 06:27:24 -0400 Received: from lprikler-laptop.ist.intra (gw.ist.tugraz.at [129.27.202.101]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4Lknbq5fk4z1LZXx; Fri, 15 Jul 2022 12:27:19 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 mailrelay.tugraz.at 4Lknbq5fk4z1LZXx DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1657880840; bh=cXDuS17W0KE9q8A4sbjhsWjwj6WOAb3RIOpln9UycFA=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=YrSQicX2hbiT+OrVf7KHcc+EtYY78sObagKywStTEOVwnhAqgiNotUJrl9wNc5Zak 9snfcKJBYmLaSBZzAiu+fy6LZYOL83xH9YZknAmTV/0Jig/iAeb9L28EnqmAgUE7Da Q66m2J0VzRxlMXrNSXkP9qd4afjxudy4DUY0dJCg= Message-ID: From: Liliana Marie Prikler Date: Fri, 15 Jul 2022 12:27:18 +0200 In-Reply-To: <87pmi6ad3v.fsf@riseup.net> References: <20220714145851.20305-1-raingloom@riseup.net> <4259f9de2b793af8d39647800d6dec0d377f02d5.camel@ist.tugraz.at> <87pmi6ad3v.fsf@riseup.net> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUG-Backscatter-control: waObeELIUl4ypBWmcn/8wQ X-Spam-Scanner: SpamAssassin 3.003001 X-Spam-Score-relay: -1.9 X-Scanned-By: MIMEDefang 2.74 on 129.27.10.116 X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Am Freitag, dem 15.07.2022 um 12:17 +0200 schrieb Csepp: > > Liliana Marie Prikler writes: > > > Am Donnerstag, dem 14.07.2022 um 16:58 +0200 schrieb raingloom: > > > * build-aux/compile-all (%): Simpler calculation that avoids > > > intermediate float. > > > --- > > >  build-aux/compile-all.scm | 2 +- > > >  1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/build-aux/compile-all.scm b/build-aux/compile- > > > all.scm > > > index 9ffbce43ad..6fdbe0dea8 100644 > > > --- a/build-aux/compile-all.scm > > > +++ b/build-aux/compile-all.scm > > > @@ -89,7 +89,7 @@ (define (parallel-job-count*) > > >   > > >  (define (% completed total) > > >    "Return the completion percentage of COMPLETED over TOTAL as > > > an > > > integer." > > > -  (inexact->exact (round (* 100. (/ completed total))))) > > > +  (quotient (* 100 completed) total)) > > I am fairly certain that this changes the semantics of %.  Try for > > example (% 23 24). > > > > Cheers > > It rounds down instead of up, which, :shrug:. > If that's a deal breaker, feel free to close this. It's not simply "rounding up", you need to round towards the nearest, which can be done with just quotient and remainder, but is probably more complicated than the float solution. From unknown Sun Jun 22 04:15:03 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: raingloom Subject: bug#56558: closed (Re: [PATCH] build: Simpler percentage calculation.) Message-ID: References: <87pmi490g1.fsf@riseup.net> <20220714145851.20305-1-raingloom@riseup.net> X-Gnu-PR-Message: they-closed 56558 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 56558@debbugs.gnu.org Date: Sat, 16 Jul 2022 22:08:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1658009282-1211-1" This is a multi-part message in MIME format... ------------=_1658009282-1211-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #56558: [PATCH] build: Simpler percentage calculation. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 56558@debbugs.gnu.org. --=20 56558: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D56558 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1658009282-1211-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 56558-close) by debbugs.gnu.org; 16 Jul 2022 22:07:10 +0000 Received: from localhost ([127.0.0.1]:46279 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oCpwM-0000IU-7v for submit@debbugs.gnu.org; Sat, 16 Jul 2022 18:07:10 -0400 Received: from mx0.riseup.net ([198.252.153.6]:47040) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oCpwH-0000Hy-WE for 56558-close@debbugs.gnu.org; Sat, 16 Jul 2022 18:07:08 -0400 Received: from fews1.riseup.net (fews1-pn.riseup.net [10.0.1.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.riseup.net", Issuer "R3" (not verified)) by mx0.riseup.net (Postfix) with ESMTPS id 4Llj4h0kDZz9s1R; Sat, 16 Jul 2022 22:07:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1658009220; bh=J+PSkVOMcOV3837FdLoK7Z4QEmWVh64PY+zMa1RADUo=; h=References:From:To:Cc:Subject:Date:In-reply-to:From; b=FQYx/PiH06EDBNKmqSre5B/MXKQlE5GK26owpN52RdoXzGhoaBCjtbCxlLhVyQ/KD 2lDMUGMcfjOp0ACaIglF8rsjy/9XZvnvKTmFrNjoGMwxzJFViCNGHm0TDS4YXde8oC a6wgx1/o1Mmq6IE+CmN2J03ifSTHUxHnIkGuaeuE= X-Riseup-User-ID: 2569688F32A1DF9E7171D89700526BA010F445AE821696DCE699E00D36A40210 Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews1.riseup.net (Postfix) with ESMTPSA id 4Llj4g2kXjz5vxk; Sat, 16 Jul 2022 22:06:58 +0000 (UTC) References: <20220714145851.20305-1-raingloom@riseup.net> <4259f9de2b793af8d39647800d6dec0d377f02d5.camel@ist.tugraz.at> <87pmi6ad3v.fsf@riseup.net> From: Csepp To: Liliana Marie Prikler Subject: Re: [PATCH] build: Simpler percentage calculation. Date: Sun, 17 Jul 2022 00:04:34 +0200 In-reply-to: Message-ID: <87pmi490g1.fsf@riseup.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 56558-close Cc: Csepp , 56558-close@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Liliana Marie Prikler writes: > Am Freitag, dem 15.07.2022 um 12:17 +0200 schrieb Csepp: >>=20 >> Liliana Marie Prikler writes: >>=20 >> > Am Donnerstag, dem 14.07.2022 um 16:58 +0200 schrieb raingloom: >> > > * build-aux/compile-all (%): Simpler calculation that avoids >> > > intermediate float. >> > > --- >> > > =C2=A0build-aux/compile-all.scm | 2 +- >> > > =C2=A01 file changed, 1 insertion(+), 1 deletion(-) >> > >=20 >> > > diff --git a/build-aux/compile-all.scm b/build-aux/compile- >> > > all.scm >> > > index 9ffbce43ad..6fdbe0dea8 100644 >> > > --- a/build-aux/compile-all.scm >> > > +++ b/build-aux/compile-all.scm >> > > @@ -89,7 +89,7 @@ (define (parallel-job-count*) >> > > =C2=A0 >> > > =C2=A0(define (% completed total) >> > > =C2=A0=C2=A0 "Return the completion percentage of COMPLETED over TOT= AL as >> > > an >> > > integer." >> > > -=C2=A0 (inexact->exact (round (* 100. (/ completed total))))) >> > > +=C2=A0 (quotient (* 100 completed) total)) >> > I am fairly certain that this changes the semantics of %.=C2=A0 Try for >> > example (% 23 24). >> >=20 >> > Cheers >>=20 >> It rounds down instead of up, which, :shrug:. >> If that's a deal breaker, feel free to close this. > It's not simply "rounding up", you need to round towards the nearest, > which can be done with just quotient and remainder, but is probably > more complicated than the float solution. Yeah, I meant it rounds up in that case. Since it's only used for indicating progress to the user, being off by 1% is not something I'd worry about, but whatevs, I guess we can leave it as is. ------------=_1658009282-1211-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 14 Jul 2022 14:59:52 +0000 Received: from localhost ([127.0.0.1]:38592 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oC0Jk-0004QG-1S for submit@debbugs.gnu.org; Thu, 14 Jul 2022 10:59:52 -0400 Received: from lists.gnu.org ([209.51.188.17]:41692) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oC0Ji-0004Q8-MQ for submit@debbugs.gnu.org; Thu, 14 Jul 2022 10:59:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oC0Ji-0004tf-Gt for guix-patches@gnu.org; Thu, 14 Jul 2022 10:59:50 -0400 Received: from mx1.riseup.net ([198.252.153.129]:43340) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oC0Jg-0007Gw-5a for guix-patches@gnu.org; Thu, 14 Jul 2022 10:59:49 -0400 Received: from fews2.riseup.net (fews2-pn.riseup.net [10.0.1.84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.riseup.net", Issuer "R3" (not verified)) by mx1.riseup.net (Postfix) with ESMTPS id 4LkHhf4gmWzDrXX for ; Thu, 14 Jul 2022 14:59:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1657810786; bh=fzL9MmKZHjHsWw4Fn0rJKtE7sxgm70HQBtuIXcqsJrE=; h=From:To:Cc:Subject:Date:From; b=EaVH86Kz2TifawsODaR4BeakiKmnR5xz1Fg8sFY84mCh8RHfhz6W2sECxbpY9Vzoy 6rqNvKNXMEahvKYASZOGZO7fJrcuiTyHvkwDR+h4DhxDjkaLYcw4UrNMbxK/XEFYWO DNCXSW4Y/CX6DNuNdZnrvQZnQBpCLONGbLRRgdUg= X-Riseup-User-ID: 71A3002FE9AA57555A6479D41E0659D74EA13E83245BBAF331A4CB3FBC896A76 Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews2.riseup.net (Postfix) with ESMTPSA id 4LkHhd5JxCz214c; Thu, 14 Jul 2022 14:59:45 +0000 (UTC) From: raingloom To: guix-patches@gnu.org Subject: [PATCH] build: Simpler percentage calculation. Date: Thu, 14 Jul 2022 16:58:51 +0200 Message-Id: <20220714145851.20305-1-raingloom@riseup.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=198.252.153.129; envelope-from=raingloom@riseup.net; helo=mx1.riseup.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit Cc: raingloom X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) * build-aux/compile-all (%): Simpler calculation that avoids intermediate float. --- build-aux/compile-all.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-aux/compile-all.scm b/build-aux/compile-all.scm index 9ffbce43ad..6fdbe0dea8 100644 --- a/build-aux/compile-all.scm +++ b/build-aux/compile-all.scm @@ -89,7 +89,7 @@ (define (parallel-job-count*) (define (% completed total) "Return the completion percentage of COMPLETED over TOTAL as an integer." - (inexact->exact (round (* 100. (/ completed total))))) + (quotient (* 100 completed) total)) ;; Install a SIGINT handler to give unwind handlers in 'compile-file' an ;; opportunity to run upon SIGINT and to remove temporary output files. -- 2.37.0 ------------=_1658009282-1211-1--