Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.arch
Subject: Re: endian history
Date: Fri, 25 Sep 2026 02:47:10 -0700
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <864ifdslwh.fsf@linuxsc.com>
References: <10uks4f$1dqo$1@gal.iecc.com> <10vphh0$3o9jl$1@dont-email.me> <117gj6t$1b95v$2@dont-email.me> <6a9c1c93.39172234@news.eternal-september.org> <117j3es$24qgq$6@dont-email.me> <117n6ho$35j69$1@paganini.bofh.team> <6a9f7664.1891062@news.eternal-september.org> <2026Sep8.125659@mips.complang.tuwien.ac.at> <117pnpg$f179$2@dont-email.me> <11898n9$1nc06$2@dont-email.me> <118d6ld$1tkm9$1@paganini.bofh.team> <118dl5f$37cfv$1@dont-email.me> <118e8kg$3f05h$1@dont-email.me> <868q4zuhz4.fsf@linuxsc.com> <118jitv$1cm6b$1@dont-email.me> <86ik42tcf4.fsf@linuxsc.com> <118uf6m$12tta$1@dont-email.me> <86ld8srnq9.fsf@linuxsc.com> <1790188863-5857@newsgrouper.org> <86cxu3sp11.fsf@linuxsc.com> <11937ek$2moih$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Fri, 25 Sep 2026 09:47:11 +0000 (UTC)
Injection-Info: dont-email.me; logging-data="3637287"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/fYxRP3IYoAEGrpYN9Vgym9t13FWP1KXA="; posting-host="f40942f53a0b7702eb43971178061210"
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:EW84Mi5U61z5u1TcfeVihv4JS7M= sha1:/iYimJh0rc9Tj9ct4azgSz0YYYg= sha256:oeeSvqt7Fq6YEERQN7BoKvFba46lhF04MKkL+mdQgFk= sha1:CungjPdZX9c/HDkmZzU6EKNqUsE= sha256:fLiPGaiYFcPotKzQ/2mGGQSzimDPwO1vCWWfGCVWwPY=
Xref: csiph.com comp.arch:118202
Terje Mathisen writes:
> Tim Rentsch wrote:
>
>> MitchAlsup writes:
[converting a signed value to a balanced base 5 representation]
>>> An obvious case where n should be unsigned not signed.
>>
>> Yes and no. It is possible to solve this problem where the
>> divisions and remainders are always done on non-negative values
>> (and so could be unsigned rather than signed). I did in fact
>> code up a solution that has this property. But such code can be
>> harder to write and harder to understand. In contrast, it's
>> fairly easy to solve this problem using signed quantities and
>> simply deals with the negative remainders appropriately. Which
>> approach is better? As usual that can depend on other factors,
>> including performance.
>
> When using a balanced encoding like I was asked to use here, any
> digit can be negative, for both positive and negative inputs:
> Only the first digit must have the same sign as the input value
> to be converted.
I get that. But to represent all the values in the range
we must deal with the possibility that other digits may
also be negative.