🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #1082

Re: reassociation and undefined behaviour

#1082
From: MitchAlsup
Date: Fri, 04 Dec 2026 20:41
28 lines
2606 bytes
EricP <ThatWouldBeTelling@thevillage.com> posted:

> On 2026-Dec-04 12:11, Thomas Koenig wrote:
> > EricP <ThatWouldBeTelling@thevillage.com> schrieb:
> >> On 2026-Dec-04 03:35, David Brown wrote:
> >>> On 03/12/2026 20:43, MitchAlsup wrote:
> >>>
> >>> So it is useful in the same way that two's complement wrapping for signed arithmetic is useful - it is absolutely absurd mathematically that you can add two positive numbers and get a negative one, there is almost certainly a bug in your program if this happens in general code, but it matches the hardware, is often harmless, and it is occasionally handy.
> >>
> >> Why is signed twos's complement wrapping mathematically absurd?
> > 
> > If you add enough apples to a pile, the number of apples becomes
> > negative (to quote Dan Brown ;-)
> > 
> 
> How is that different than wrapping from positive down to zero?

It changes how one observes OVERFLOW.

> That's just how modulo arithmetic works.

Sure.
 
> I'm not suggesting modulo is equivalent to linear arithmetic.
> Just that mod-256 wrapping from +127 to -128 is no different
> than +255 to 0.

     if( number > high_range ) number -= high_range;
Technical Details
Message-ID: <1796416884-5857@newsgrouper.org>
Path: mbox-mo1.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!newsgrouper.org!.POSTED!not-for-mail
References: <11cpqih$acf5$1@dont-email.me> <86o6b6kaqf.fsf@linuxsc.com> <11ejr5e$nk8$1@reader2.panix.com> <11ejtoe$eoj7$1@dont-email.me> <11el2c1$q43$1@reader2.panix.com> <11emcgn$1k681$1@dont-email.me> <jwvbj74bzm4.fsf-monnier+comp.arch@gnu.org> <11eolqn$2peg5$1@dont-email.me> <2026Dec2.132411@mips.complang.tuwien.ac.at> <11epd07$362ph$1@dont-email.me> <1796263648-5857@newsgrouper.org> <11ergn7$6utu$1@dont-email.me> <2026Dec3.122036@mips.complang.tuwien.ac.at> <1796326998-5857@newsgrouper.org> <11etu0b$1aih9$1@dont-email.me> <TlCQS.44884$7vt4.19168@fx07.iad> <11eus8u$1q9ee$1@dont-email.me> <gmDQS.352851$ZAo7.329237@fx18.iad>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!newsgrouper.org!.POSTED!not-for-mail
From: MitchAlsup <user5857@newsgrouper.org.invalid>
Newsgroups: comp.arch
Subject: Re: reassociation and undefined behaviour
References: <11cpqih$acf5$1@dont-email.me> <86o6b6kaqf.fsf@linuxsc.com>
  <11ejr5e$nk8$1@reader2.panix.com> <11ejtoe$eoj7$1@dont-email.me>
  <11el2c1$q43$1@reader2.panix.com> <11emcgn$1k681$1@dont-email.me>
  <jwvbj74bzm4.fsf-monnier+comp.arch@gnu.org> <11eolqn$2peg5$1@dont-email.me>
  <2026Dec2.132411@mips.complang.tuwien.ac.at> <11epd07$362ph$1@dont-email.me>
  <1796263648-5857@newsgrouper.org> <11ergn7$6utu$1@dont-email.me>
  <2026Dec3.122036@mips.complang.tuwien.ac.at>
  <1796326998-5857@newsgrouper.org> <11etu0b$1aih9$1@dont-email.me>
  <TlCQS.44884$7vt4.19168@fx07.iad> <11eus8u$1q9ee$1@dont-email.me> <gmDQS.352851$ZAo7.329237@fx18.iad>
Date: Fri, 04 Dec 2026 20:41:24 GMT
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Message-ID: <1796416884-5857@newsgrouper.org>
Injection-Info: newsgrouper.org; mail-complaints-to="newsgrouper@yahoo.com"; posting-account=user5857
Injection-Date: Fri, 04 Dec 2026 20:41:24 GMT
User-Agent: Newsgrouper/0.9.0