From: Csepp <raingloom@riseup.net>
To: Liliana Marie Prikler <liliana.prikler@ist.tugraz.at>
Cc: Csepp <raingloom@riseup.net>, 56558-close@debbugs.gnu.org
Subject: bug#56558: [PATCH] build: Simpler percentage calculation.
Date: Sun, 17 Jul 2022 00:04:34 +0200 [thread overview]
Message-ID: <87pmi490g1.fsf@riseup.net> (raw)
In-Reply-To: <af1599612cf7ffa5dcb3d7133c4e8eda8746ab9d.camel@ist.tugraz.at>
Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes:
> Am Freitag, dem 15.07.2022 um 12:17 +0200 schrieb Csepp:
>>
>> Liliana Marie Prikler <liliana.prikler@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.
> 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.
prev parent reply other threads:[~2022-07-16 22:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-14 14:58 [bug#56558] [PATCH] build: Simpler percentage calculation raingloom
2022-07-15 8:22 ` Liliana Marie Prikler
2022-07-15 10:17 ` Csepp
2022-07-15 10:27 ` Liliana Marie Prikler
2022-07-16 22:04 ` Csepp [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pmi490g1.fsf@riseup.net \
--to=raingloom@riseup.net \
--cc=56558-close@debbugs.gnu.org \
--cc=liliana.prikler@ist.tugraz.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).