GNU bug report logs - #56558
[PATCH] build: Simpler percentage calculation.

Previous Next

Package: guix-patches;

Reported by: raingloom <raingloom <at> riseup.net>

Date: Thu, 14 Jul 2022 15:00:02 UTC

Severity: normal

Tags: patch

Done: Csepp <raingloom <at> riseup.net>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 56558 <at> debbugs.gnu.org (full text, mbox):

From: Csepp <raingloom <at> riseup.net>
To: Liliana Marie Prikler <liliana.prikler <at> ist.tugraz.at>
Cc: 56558 <at> debbugs.gnu.org, raingloom <raingloom <at> riseup.net>
Subject: Re: [PATCH] build: Simpler percentage calculation.
Date: Fri, 15 Jul 2022 12:17:30 +0200
Liliana Marie Prikler <liliana.prikler <at> ist.tugraz.at> 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.




This bug report was last modified 2 years and 346 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.