Deutsch   English   Français   Italiano  
<ll7ch8Fm3ohU1@mid.individual.net>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!news.nobody.at!2.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Newsgroups: comp.arch
Subject: Re: is Vax addressing sane today
Date: Sat, 21 Sep 2024 10:56:24 +0300
Organization: Tidorum Ltd
Lines: 29
Message-ID: <ll7ch8Fm3ohU1@mid.individual.net>
References: <vbd6b9$g147$1@dont-email.me>
 <09ce1622b872f0b0fa944e868a8c97be@www.novabbs.org>
 <vbnisc$2hb59$1@dont-email.me> <2024Sep10.094353@mips.complang.tuwien.ac.at>
 <vckf9d$178f2$1@dont-email.me> <vcl6hb$1abo5$2@dont-email.me>
 <34ead356397a90581e80837ef304b6ef@www.novabbs.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net o/XtKK8nYstyiB7EbKXxFAuD5LH9HyB2fi7t+ik83DOGb3y1LI
Cancel-Lock: sha1:by3NQr0YLQVzOi0H616MQrLacuI= sha256:p0CulpnN58PZU8mDcpb78UiPR+uYcqzyb4AMgbgupw8=
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <34ead356397a90581e80837ef304b6ef@www.novabbs.org>
Bytes: 2366

On 2024-09-21 4:51, MitchAlsup1 wrote:
> On Sat, 21 Sep 2024 1:12:11 +0000, Lawrence D'Oliveiro wrote:
> 
>> On Fri, 20 Sep 2024 18:35:26 -0000 (UTC), Kent Dickey wrote:
>>
>>> 3) You want to clamp the value to a reasonable range and continue.  The
>>>     reasonable values need to be looked up somewhere.
>>
>> This won’t work. The values outside the range are by definition non-
>> representable, so comparisons against them are useless.
> 
> When a range is 0..10 both -1 and 11 are representable in
> the arithmetic of ALL computers, just not in the language
> specifying the range.


For "11" I agree, for "-1" disagree.

if the program was written (in whatever language) with the assumption 
that the data type in question is unsigned, then it cannot represent -1 
in the program's view of the bits. The bits that represent -1 in a 
signed two's complement view represent a large positive value in the 
unsigned view that the code uses.

Now if the error condition that was trapped or detected was an attempt 
to produce a negative value like -1 for an unsigned data type, that 
error condition is of course representable separately; it does not have 
to be encoded by an out-of-range value in the data type itself.