Deutsch   English   Français   Italiano  
<86ldzrat75.fsf@linuxsc.com>

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

Path: ...!news.nobody.at!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups: comp.arch
Subject: Re: Computer architects leaving Intel...
Date: Mon, 16 Sep 2024 19:51:26 -0700
Organization: A noiseless patient Spider
Lines: 54
Message-ID: <86ldzrat75.fsf@linuxsc.com>
References: <2024Aug30.161204@mips.complang.tuwien.ac.at> <vbcob9$dvp4$1@dont-email.me> <vbd6ia$e0ld$2@dont-email.me> <UxpCO.174965$Hld5.7714@fx15.iad> <vc41rl$1fhjd$1@dont-email.me> <86jzfccri4.fsf@linuxsc.com> <vc8mhi$2n382$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Tue, 17 Sep 2024 04:51:27 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="5475264e673852879913d2eef8867355";
	logging-data="3478526"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/wmnBCWFqdZtcOp/J9pVkG+djvWzSDAkI="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:0H3CYDGo1DS+dLAZ2ovylkd1Kmo=
	sha1:N/Vwa+uXNOgVgqFCLpt+72+m90I=
Bytes: 2768

Thomas Koenig <tkoenig@netcologne.de> writes:

> Tim Rentsch <tr.17687@z991.linuxsc.com> schrieb:
>
>> If the loop variable
>> represents degrees C or F, or some other naturally signed measure it
>> should be signed (or maybe floating point).
>
> The first one is a bad idea because temperature is a continuous
> physical quantity.

That doesn't mean that a quantity representing degrees C or
degrees F in a computer program always has to be a continuous
measure.  Sometimes a signed integer for degrees is what's
needed.  It depends on circumstances.

> The second has bad implications for constructs like
>
>       DO R = 0.0, 1.0, 0.1
>
> where it will depend on details floating point arithmetic if the
> number of loop trips is 10 or 11.
>
> You can argue that people can write
>
>       DO R=0.0, 1.05, 0.1
>
> but this construct was error-prone enough that it was deleted
> from the Fortran standards.
>
>> What kind of loop it
>> is, whether ascending or descending, or what the increment is, etc,
>> is secondary;  a more important factor is what sort of value is
>> being represented, and in almost all cases that is what should
>> determine the type used.
>
> Not for floating point numbers.  For that, you should simply do
>
>       DO I=0,10
>         R = I * 0.1
>
> or
>
>       R = 0.0
>       DO I=0,10
> ...
>         R = R + 0.1
>       END DO
>
> whichever rounding error you prefer.

In cases like these I mean R as the loop variable.  The extra
stuff is incidental scaffolding there only to make sure R
takes on all the appropriate values.