Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

One person's error is another person's data.


devel / comp.lang.c / Re: bart again (UCX64)

SubjectAuthor
* bart again (UCX64)candycane
`* bart again (UCX64)Richard Damon
 `* bart again (UCX64)Keith Thompson
  `* bart again (UCX64)Richard Damon
   `* bart again (UCX64)Keith Thompson
    +* bart again (UCX64)Kaz Kylheku
    |`* bart again (UCX64)David Brown
    | `* bart again (UCX64)Malcolm McLean
    |  +* bart again (UCX64)David Brown
    |  |+* bart again (UCX64)Bart
    |  ||+* bart again (UCX64)Kaz Kylheku
    |  |||`- bart again (UCX64)David Brown
    |  ||`* bart again (UCX64)David Brown
    |  || `* bart again (UCX64)Kaz Kylheku
    |  ||  `* bart again (UCX64)David Brown
    |  ||   `* bart again (UCX64)Kaz Kylheku
    |  ||    `* bart again (UCX64)David Brown
    |  ||     +* bart again (UCX64)Bart
    |  ||     |`* bart again (UCX64)David Brown
    |  ||     | `* bart again (UCX64)Bart
    |  ||     |  `- bart again (UCX64)David Brown
    |  ||     `* bart again (UCX64)Kaz Kylheku
    |  ||      `- bart again (UCX64)David Brown
    |  |+* bart again (UCX64)Malcolm McLean
    |  ||`* bart again (UCX64)David Brown
    |  || `* bart again (UCX64)Malcolm McLean
    |  ||  +* bart again (UCX64)Ben Bacarisse
    |  ||  |`* bart again (UCX64)Malcolm McLean
    |  ||  | `- bart again (UCX64)Ben Bacarisse
    |  ||  `* bart again (UCX64)David Brown
    |  ||   `* bart again (UCX64)David Brown
    |  ||    +- bart again (UCX64)Chris M. Thomasson
    |  ||    +* bart again (UCX64)Malcolm McLean
    |  ||    |`* bart again (UCX64)David Brown
    |  ||    | `* bart again (UCX64)Malcolm McLean
    |  ||    |  `* bart again (UCX64)David Brown
    |  ||    |   +* bart again (UCX64)Bart
    |  ||    |   |`- bart again (UCX64)David Brown
    |  ||    |   +- bart again (UCX64)Kaz Kylheku
    |  ||    |   +- bart again (UCX64)David Brown
    |  ||    |   `- bart again (UCX64)Kaz Kylheku
    |  ||    `* bart again (UCX64)Bart
    |  ||     +* bart again (UCX64)Malcolm McLean
    |  ||     |`* bart again (UCX64)Kaz Kylheku
    |  ||     | `- bart again (UCX64)Malcolm McLean
    |  ||     +- bart again (UCX64)David Brown
    |  ||     `* bart again (UCX64)Ben Bacarisse
    |  ||      +* bart again (UCX64)Bart
    |  ||      |+- bart again (UCX64)David Brown
    |  ||      |`* bart again (UCX64)Ben Bacarisse
    |  ||      | `* bart again (UCX64)Bart
    |  ||      |  +* bart again (UCX64)Scott Lurndal
    |  ||      |  |`- bart again (UCX64)David Brown
    |  ||      |  `- bart again (UCX64)Ben Bacarisse
    |  ||      `* bart again (UCX64)Malcolm McLean
    |  ||       +* bart again (UCX64)Ben Bacarisse
    |  ||       |+* bart again (UCX64)Bart
    |  ||       ||+* bart again (UCX64)Malcolm McLean
    |  ||       |||`* bart again (UCX64)Scott Lurndal
    |  ||       ||| `* bart again (UCX64)Bart
    |  ||       |||  +- bart again (UCX64)Richard Damon
    |  ||       |||  +- bart again (UCX64)Scott Lurndal
    |  ||       |||  `* bart again (UCX64)Ben Bacarisse
    |  ||       |||   `* bart again (UCX64)Bart
    |  ||       |||    `* bart again (UCX64)Ben Bacarisse
    |  ||       |||     `- bart again (UCX64)Bart
    |  ||       ||`* bart again (UCX64)Ben Bacarisse
    |  ||       || `* bart again (UCX64)Malcolm McLean
    |  ||       ||  `* bart again (UCX64)Ben Bacarisse
    |  ||       ||   +* bart again (UCX64)Bart
    |  ||       ||   |+* bart again (UCX64)David Brown
    |  ||       ||   ||`* bart again (UCX64)Ben Bacarisse
    |  ||       ||   || +* bart again (UCX64)David Brown
    |  ||       ||   || |`- bart again (UCX64)David Brown
    |  ||       ||   || `* bart again (UCX64)Tim Rentsch
    |  ||       ||   ||  `- bart again (UCX64)Ben Bacarisse
    |  ||       ||   |`* bart again (UCX64)Ben Bacarisse
    |  ||       ||   | +- bart again (UCX64)Ben Bacarisse
    |  ||       ||   | `- bart again (UCX64)Tim Rentsch
    |  ||       ||   `* bart again (UCX64)Malcolm McLean
    |  ||       ||    +* bart again (UCX64)Scott Lurndal
    |  ||       ||    |`* bart again (UCX64)Malcolm McLean
    |  ||       ||    | `* bart again (UCX64)Scott Lurndal
    |  ||       ||    |  +* bart again (UCX64)David Brown
    |  ||       ||    |  |`* bart again (UCX64)David Brown
    |  ||       ||    |  | `- bart again (UCX64)David Brown
    |  ||       ||    |  `* bart again (UCX64)David Brown
    |  ||       ||    |   `* bart again (UCX64)Malcolm McLean
    |  ||       ||    |    `* bart again (UCX64)David Brown
    |  ||       ||    |     +* bart again (UCX64)Scott Lurndal
    |  ||       ||    |     |+* bart again (UCX64)James Kuyper
    |  ||       ||    |     ||`* bart again (UCX64)Kaz Kylheku
    |  ||       ||    |     || +* [meta] spam in threadMalcolm McLean
    |  ||       ||    |     || |+* [meta] spam in threadKaz Kylheku
    |  ||       ||    |     || ||`- [meta] spam in threadMalcolm McLean
    |  ||       ||    |     || |`- [meta] spam in threadDavid Brown
    |  ||       ||    |     || `- bart again (UCX64)Ben Bacarisse
    |  ||       ||    |     |`* bart again (UCX64)Tim Rentsch
    |  ||       ||    |     | `* bart again (UCX64)Keith Thompson
    |  ||       ||    |     |  `* bart again (UCX64)Tim Rentsch
    |  ||       ||    |     |   +- bart again (UCX64)Chris M. Thomasson
    |  ||       ||    |     |   `* bart again (UCX64)Keith Thompson
    |  ||       ||    |     `* bart again (UCX64)Malcolm McLean
    |  ||       ||    `* bart again (UCX64)Ben Bacarisse
    |  ||       |+- bart again (UCX64)Ben Bacarisse
    |  ||       |`- bart again (UCX64)David Brown
    |  ||       `* bart again (UCX64)David Brown
    |  |`* bart again (UCX64)Kaz Kylheku
    |  `* bart again (UCX64)Scott Lurndal
    +- bart again (UCX64)David Brown
    `- bart again (UCX64)Richard Damon

Pages:12345
Re: bart again (UCX64)

<877counnej.fsf@bsb.me.uk>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=45475&group=comp.lang.c#45475

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Wed, 13 Sep 2023 15:44:20 +0100
Organization: A noiseless patient Spider
Lines: 169
Message-ID: <877counnej.fsf@bsb.me.uk>
References: <1262755563@f172.n1.z21.fsxnet>
<87y1hhmehf.fsf@nosuchdomain.example.com>
<20230907235623.619@kylheku.com> <udeksu$3crce$1@dont-email.me>
<4945f15a-22dd-431e-a732-81ed36615f27n@googlegroups.com>
<udepd1$3dal1$2@dont-email.me>
<543b9acc-de99-425c-bb1d-485e9f98889dn@googlegroups.com>
<udf9jn$3fta8$1@dont-email.me>
<7cf7b6bd-39d9-4e22-baee-e128cfb2f214n@googlegroups.com>
<udk4a5$hkp5$1@dont-email.me>
<8238a0d7-aeb2-4b26-8b1d-611caa37049an@googlegroups.com>
<udmddn$v4e7$1@dont-email.me> <udmpuu$110jq$1@dont-email.me>
<8734zkspd5.fsf@bsb.me.uk>
<f7077ac4-908c-41e9-96a0-58cf9df4d494n@googlegroups.com>
<87ledcqrp0.fsf@bsb.me.uk> <udo4s3$17hu7$1@dont-email.me>
<87ledcp05z.fsf@bsb.me.uk>
<678354ed-d89c-4d45-adfd-1ded3d22eecan@googlegroups.com>
<87ttrzo1zm.fsf@bsb.me.uk>
<5e098055-c3bd-4f9c-984c-b4fdaf610adbn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="d402efe92178590df0c731029dbf3024";
logging-data="2289474"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18oyLrcNqiJ87O1fWtF3LCzMgWKVc0d/Yo="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:acn9TS8Ug0o70rW8uP6o8VfqgIg=
sha1:gPznrLImiTUUAPM2zk50QXm9apk=
X-BSB-Auth: 1.1f43cbcece41e8bda916.20230913154420BST.877counnej.fsf@bsb.me.uk
 by: Ben Bacarisse - Wed, 13 Sep 2023 14:44 UTC

Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

> On Tuesday, 12 September 2023 at 16:17:18 UTC+1, Ben Bacarisse wrote:
>> Malcolm McLean <malcolm.ar...@gmail.com> writes:
>>
>> It is a mistake to link the error with the two behaviours. A single
>> error can provoke either or neither behaviour, sometimes always or
>> never. It's not uncommon for an error to go entirely unnoticed because
>> the behaviour is always correct. Maybe the fix is to put in "return 0;"
>> but that happens to be what is in this or that register on this C
>> implementation on this hardware at the point where the call happens.
>>
>> This is not quibbling or sophistry. The errors are in the text and the
>> behaviours are in the world. But We can only fix the text. That is the
>> only way a programmer can alter the behaviour.
>>
> That is a fair point. You can have an error which in fact never provokes incorrect
> behaviour. For example to use sign() again, if we write it to return -1 or +1
> and forget the zero, it might well aways return zero when it falls of the end
> for the case 0. It would be an error in the program text, but it would behave
> correctly.
>>
>> > I can't
>> > think of another behaviour that is erroneous but doesn't fall under
>> > one of those two categories (though someone might be able to suggest
>> > one).
>> I can (timeliness comes to mind) but that would be quibbling. The big
>> issue is that I reject the notion that one error implies one of two
>> behaviours.
>>
>> Why does this matter? Because it's just programming. There should be a
>> specification where you have left a void for this mystery program. The
>> life support system should be specified to provide timely and correct
>> results to the oxygen valve or to stop in such a way to provoke other
>> systems to trigger the alarms other wise.
>>
> It's specified to always control the flow of oxygen, based on various
> readings it takes from sensors attached to the patient.

That might be the first specification, but it will get revised at the
first review before a line of code is written.

> If it stops controlling the flow
> of oxygen, that's very serious. The alarm goes off. The nurse should come.
> But it's very much an emergency and undesired.

It might be very much desired considering the alternatives. But the
point is that something needs to stated so that we know what to
implement. You might assume that any sane programmer will, in effect,
be implementing my revised spec, but that's not how to do serious work.

>> Putting an abort() call and the end of sign(x) (if that is indeed what
>> you are suggesting) is called meeting the specification. Of course
>> there can be bugs (the call was missing at first) but that is just
>> programming. There are, of course, thousands of other fixes.
>>
> Not. it's not meeting the specification.

Now there's a spec, and an impossible one at that! In my remark I had
to guess what you want because it was, up to that point, unspecified.
(Or did I miss it?)

I think the impossible spec is not an accident. You want the discussion
to be forced into the wrong result/no result divide, where I insist on
failure modes being specified because I want to focus on the
correct/incorrect divide.

>> That the author
>> of sign(x) did not consider NaNs is no different to an author no
>> different considering a factor 10^6 error in the flow rate, except that
>> it's easier to avoid NaNs than it is to avoid simple typos.
>>
> sign() has a core domain which includes all the real numbers. You
> might know that none of the reals in the program can be lower than
> unity. But you can't sensibly trap such numbers and still call the
> function sign(). NaN isn't in the core domain. We can sensibly say
> that sing(NaN) is NaN, or at a stretch, even 0. But we can also say
> that calling sign with NaN is to be considered a programming error.

I really, genuinely, have no idea what your point it. You appear to
describing the basics of how one writes code, informally, with no clear
objectives in mind. We could this, we could that: NaNs are in the
domain but not in the core domain. We could return NaN or 0 or trap a
programming error if one is passed.

>> > You've been reading too much David Brown, and got infected. Anyone with
>> > any experience in programming knows that often bugs are very simple and
>> > obvious. Once you point them out. But highly qualified programmers still
>> > make such mistakes.
>>
>> I don't believe DB thinks what you believe he does. I certainly don't
>> think that. And I resent the notion that I have been "infected" by a
>> bad thought, especially one I am sure you have made up out of thin air.
>> Please acknowledge that I am perfectly aware that all programmers make
>> mistakes. Without that, there is simply no point in continuing.
>>
> Fair enough. Unlike some other posters, you don't look for
> opportuniites to snipe. If you think the NaN comparison error is too
> simple, you can always think of a way to make it a bit more subtle
> whilst still being bascially the same bug.

I am happy to stick with rather artificial examples, but you are not
getting to the point. What is the bug? Does the code somehow magic up
NaNs and if so from where? Do you agree that one bug can produce many
different behaviours and at different times? Do you accept that the
specification should say what happens when the sensors fail, or the
correct operation can no longer be guaranteed? This discussion feels
like nailing a jelly to the fence.

> Similar errors do make their way into critical systems where the costs are
> extremely high, like spacecraft, and there have been reports.

Yes. But what are you proposing to do about it that you think differs
from my methods? My proposal is simple to state: minimise the chance of
errors in the program; that is cases where the program might not behave
as specified. This can include improving the specification as well as
the code. Possibly the only disagreement (if you will accept the
correct/incorrect classification rather than yours) is that sound
reasoning plays a part in my proposal. I would happily include a
rigorous code review to ensure that, say, NaNs and Infinities never
occur. These are not magic quantities but specific values that arise in
tightly controlled and well-specified situations. Such a review is no
harder than one that tries to ensure that the value sent to value
controller is within the correct technical bounds.

>> The issue, which you don't seem to be addressing, is what we do about
>> it. We don't just look at code and say, "that looks like a bug, let's
>> put an abort() in there". The whole software development process has to
>> be geared to minimising the ways in which a program text might fail to
>> behave as required. For some programs, the specification is to generate
>> correct results or to fail hard. For others it is to keep going at all
>> costs.
>>
>> One technique that can help (in one small area) is to try to ensure that
>> there are no NaNs. That can be simpler than putting in tests or other
>> actions all over the place in case one has just popped up like a genie
>> from a lamp. Note that I am not saying there can't be bugs, but I would
>> bet any money that a code review for "don't ever generate a NaN" is
>> easier and more effective than a code review for "check everywhere it
>> might matter for NaNs and act accordingly".
>>
> But in this case, readsensors() returns a NaN if the sensors have no data
> (not working, or maybe not enough time lag between calls). That's a reasonable
> interface. So we can't say "exclude all NaNs for the code". But a NaN still
> shouldn't be passed to sign(). That's the programming error.

OK. There's a bit more detail. But I can't address it because you
don't say what should happen. Anything I propose will be met by "no,
that's not meeting the specification".

>> > No we can't use Haskell.
>> That's a shame. The Glasgow Haskell compiler reports that in
>>
>> sign :: Double -> Int
>> sign x | x < 0 = -1
>> | x == 0 = 0
>> | x > 0 = 1
>>
>> the guards are non-exhaustive.
>>
> That's very good.

As it happens (thanks, David) it isn't. The warning can include false
positives because the analysis is crude. Of course it still helps if
you want look for possible problem areas because there are no false
negatives, but it's not doing what I hoped.


Click here to read the complete article
Re: bart again (UCX64)

<udsjcl$25tg7$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=45476&group=comp.lang.c#45476

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jameskuyper@alumni.caltech.edu (James Kuyper)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Wed, 13 Sep 2023 11:10:13 -0400
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <udsjcl$25tg7$1@dont-email.me>
References: <1262755563@f172.n1.z21.fsxnet>
<678354ed-d89c-4d45-adfd-1ded3d22eecan@googlegroups.com>
<87ttrzo1zm.fsf@bsb.me.uk>
<5e098055-c3bd-4f9c-984c-b4fdaf610adbn@googlegroups.com>
<DD0MM.39423$jJK6.35686@fx14.iad>
<647ac7a4-fb14-4072-b65f-5b20290a4b7bn@googlegroups.com>
<KN1MM.6185$Q73f.3452@fx48.iad>
<1ad9d75b-48bb-4b3a-93f0-92900479280en@googlegroups.com>
<uds4rb$23he0$1@dont-email.me>
<e837db60-7ae9-4aa6-b539-424b97579e4dn@googlegroups.com>
<udsach$24go6$1@dont-email.me> <60jMM.5116$quJ8.2754@fx18.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 13 Sep 2023 15:10:13 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="4b014c7d95708532046e677d3fab2243";
logging-data="2291207"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Ty92LHh80OeYTgBYuhOoCga/o4ZvAIrE="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.15.0
Cancel-Lock: sha1:DxQYpSZ+3Ne3tnF0Jhr/PAOKKXs=
Content-Language: en-US
In-Reply-To: <60jMM.5116$quJ8.2754@fx18.iad>
 by: James Kuyper - Wed, 13 Sep 2023 15:10 UTC

On 9/13/23 09:43, Scott Lurndal wrote:
....
> Indeed, NaN is a term of art referring specifically to the IEEE
> floating point standard. I've never seen "NaN" used in any
> other context (albeit some use it to refer to their grandmother :-).

Most general rules have at least one exception.

The wikipedia article on NaNs points out that there is a private
standard for something called posits, which are an alternative to IEEE
754. They have a similar concept NaR:="Not a Real", which differs from a
NaN mainly in that NaRs compare equal to each other. There is a
particular implementation of posits using C++ templates called
cppPosits, that provides non-standard support for posit NaNs that are
similar to IEEE NaNs.

Re: bart again (UCX64)

<0pkMM.961$Yxl8.700@fx14.iad>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=45477&group=comp.lang.c#45477

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx14.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: scott@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: bart again (UCX64)
Newsgroups: comp.lang.c
References: <1262755563@f172.n1.z21.fsxnet> <87ttrzo1zm.fsf@bsb.me.uk> <5e098055-c3bd-4f9c-984c-b4fdaf610adbn@googlegroups.com> <DD0MM.39423$jJK6.35686@fx14.iad> <647ac7a4-fb14-4072-b65f-5b20290a4b7bn@googlegroups.com> <KN1MM.6185$Q73f.3452@fx48.iad> <1ad9d75b-48bb-4b3a-93f0-92900479280en@googlegroups.com> <uds4rb$23he0$1@dont-email.me> <e837db60-7ae9-4aa6-b539-424b97579e4dn@googlegroups.com> <udsach$24go6$1@dont-email.me> <3d75c8ee-f1b2-4ec3-bb5b-485d23a2c634n@googlegroups.com>
Lines: 54
Message-ID: <0pkMM.961$Yxl8.700@fx14.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Wed, 13 Sep 2023 15:18:20 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Wed, 13 Sep 2023 15:18:20 GMT
X-Received-Bytes: 3324
 by: Scott Lurndal - Wed, 13 Sep 2023 15:18 UTC

Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>On Wednesday, 13 September 2023 at 13:36:47 UTC+1, David Brown wrote:

>> > Scott said "we have no NaNs". But what he meant was that we have no
>> > NaNs as formally specified by IEEE.
>> I took Scott's "NaNs never occur in my code" comment to mean that NaN's
>> - floating point NaNs, since that was the context - do not occur in the
>> code he writes. He wrote what he meant (AFAIK), and it was perfectly clear.
>>
>Yes, it's perfectly clear wht he means. NaN is an IEEE representation which
>means that a varaible doesn't hold a number. And he doesn't have any such
>representations in his code. And you can do without them. But only by having
>an alternative representation that mean s"this variable does not hold a number".

Indeed one can do without IEEE NaNs. Particularly in real-time, safety critical
code.

An "alternative representation" (your terminology) isn't a NaN. And the
variable does hold a number, a perfectly valid number. As David noted,
any value outside of the domain of the problem can be used to signal
an error condition. Or it could be a completely separate flag variable.
Or any number of possibilities. None of which are NaNs.

>
>That's what wasn't taken on board and people are struggling with.

I think the only person struggling in this conversation is Malcolm.

>
>You achieve vety little by rejecting the accepted, formally specified, supported
>representation of not a number, and substituting your own ad hoc representation.

And if my microcontroller doesn't have floating point?

>> Both are simple to do in C. Exceptions are nothing more than an
>> alternative way to return particular types of values that are convenient
>> and efficient for some kinds of coding.
>>
>No look. We have a C interface. In C, the only easy way to write the code to
>read the sensors is something like this.

Wow, that's a rather arrogant statement.

>
>oxygen_flow_t oxygen;
>
>oxygen = readsensors();
>/* this code is always reached */
>if (doesent_have_a_value(oxygen))
> /* handle missing data here */

bool readsensors(oxygen_flow_t *oxygenp);

if (!readsensors(&oxygen)) handle_sensor_borked().

Re: bart again (UCX64)

<udsok7$274aa$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=45478&group=comp.lang.c#45478

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.brown@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Wed, 13 Sep 2023 18:39:34 +0200
Organization: A noiseless patient Spider
Lines: 142
Message-ID: <udsok7$274aa$1@dont-email.me>
References: <1262755563@f172.n1.z21.fsxnet> <udmddn$v4e7$1@dont-email.me>
<udmpuu$110jq$1@dont-email.me> <8734zkspd5.fsf@bsb.me.uk>
<f7077ac4-908c-41e9-96a0-58cf9df4d494n@googlegroups.com>
<87ledcqrp0.fsf@bsb.me.uk> <udo4s3$17hu7$1@dont-email.me>
<87ledcp05z.fsf@bsb.me.uk>
<678354ed-d89c-4d45-adfd-1ded3d22eecan@googlegroups.com>
<87ttrzo1zm.fsf@bsb.me.uk>
<5e098055-c3bd-4f9c-984c-b4fdaf610adbn@googlegroups.com>
<DD0MM.39423$jJK6.35686@fx14.iad>
<647ac7a4-fb14-4072-b65f-5b20290a4b7bn@googlegroups.com>
<KN1MM.6185$Q73f.3452@fx48.iad>
<1ad9d75b-48bb-4b3a-93f0-92900479280en@googlegroups.com>
<uds4rb$23he0$1@dont-email.me>
<e837db60-7ae9-4aa6-b539-424b97579e4dn@googlegroups.com>
<udsach$24go6$1@dont-email.me>
<3d75c8ee-f1b2-4ec3-bb5b-485d23a2c634n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 13 Sep 2023 16:39:35 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="51c48b399e73ee5caec2f0cf83b8ec11";
logging-data="2330954"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/18ti9BtBThnpVQqgI+nfy+v89hVP4Wsg="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:aMlQV5k09DLbsOftOvuf9k/GQHA=
Content-Language: en-GB
In-Reply-To: <3d75c8ee-f1b2-4ec3-bb5b-485d23a2c634n@googlegroups.com>
 by: David Brown - Wed, 13 Sep 2023 16:39 UTC

On 13/09/2023 16:39, Malcolm McLean wrote:
> On Wednesday, 13 September 2023 at 13:36:47 UTC+1, David Brown wrote:
>> On 13/09/2023 13:45, Malcolm McLean wrote:
>>> On Wednesday, 13 September 2023 at 12:02:44 UTC+1, David Brown wrote:
>>>> On 13/09/2023 10:47, Malcolm McLean wrote:
>>>>> On Tuesday, 12 September 2023 at 19:07:54 UTC+1, Scott Lurndal wrote:
>>>>>> Malcolm McLean <malcolm.ar...@gmail.com> writes:
>>>>>>> On Tuesday, 12 September 2023 at 17:48:52 UTC+1, Scott Lurndal wrote:
>>>>>>>> Malcolm McLean <malcolm.ar...@gmail.com> writes:
>>>>>>>>> On Tuesday, 12 September 2023 at 16:17:18 UTC+1, Ben Bacarisse wrote:
>>>>>>>>>> Malcolm McLean <malcolm.ar...@gmail.com> writes:
>>>>>>>>>>
>>>>>>>>
>>>>>>>> In both cases, they're simple integers well within the
>>>>>>>> range of a 32-bit unsigned integer and there will never
>>>>>>>> be a NaN.
>>>>>>>>
>>>>>>> So what happens if the sensor doesn't give a reading?
>>>>>>>
>>>>>> I would assume that the designer would anticipate such a
>>>>>> condition and the function that obtains the sensor reading
>>>>>> would indicate a failure condition that would be handled
>>>>>> according to the design specification. There is no need
>>>>>> to use a NaN for that, there are dozens of alternatives.
>>>>>>
>>>>> So an alternative would be
>>>>>
>>>>> /* return sensor reading in 16:16 fixed point format, INT_MAX for
>>>>> sensor fail */
>>>>>
>>>>> So what have we done? We got an informally specified NaN. INT_MAX
>>>>> is "not a number" in this context.
>>>>
>>> Scott said "we have no NaNs". But what he meant was that we have no
>>> NaNs as formally specified by IEEE.
>> I took Scott's "NaNs never occur in my code" comment to mean that NaN's
>> - floating point NaNs, since that was the context - do not occur in the
>> code he writes. He wrote what he meant (AFAIK), and it was perfectly clear.
>>
> Yes, it's perfectly clear wht he means. NaN is an IEEE representation which
> means that a varaible doesn't hold a number. And he doesn't have any such
> representations in his code. And you can do without them. But only by having
> an alternative representation that mean s"this variable does not hold a number".

No, you don't /need/ that.

You don't always need fault detection. If you have fault detection, you
don't always have to pass it back to the calling function. If you have
fault detection and pass it back, you don't always have to have a single
"not a number" state. You might have many. You might pass the validity
or status information in a different way. You might block the reading
until valid data is available.

There are countless alternatives here.

>
> That's what wasn't taken on board and people are struggling with.
>

People struggle to understand why you have such a black-and-white view
of the world, and are so convinced that your own made-up rules apply to
everything.

> You achieve vety little by rejecting the accepted, formally specified, supported
> representation of not a number, and substituting your own ad hoc representation.

Again, nonsense. I really cannot imagine where you get your ideas.

>
>>> If the sensor doesn't return a reading, you either have to represent that in
>>> some way, which means that you need some sort of not a number representation,
>>> or you have to make it impossible to read the sensor before checking that it
>>> has a value. But the last is hard to achieve in C. (In C++ you can throw if the
>>> sensor doesn't have a value, so code that operates on the missing value will
>>> never be executed).
>> Both are simple to do in C. Exceptions are nothing more than an
>> alternative way to return particular types of values that are convenient
>> and efficient for some kinds of coding.
>>
> No look. We have a C interface. In C, the only easy way to write the code to

Once I read "the only easy way", I knew you were wrong. I don't even
need to read further - you are wrong. Every time you think you have the
unique answer, and that every situation fits into one or two neat
categories, you are wrong.

> read the sensors is something like this.
>
> oxygen_flow_t oxygen;
>
> oxygen = readsensors();
> /* this code is always reached */
> if (doesent_have_a_value(oxygen))
> /* handle missing data here */
>

No. That is one way to write it.

It can be a convenient way, but it is not the only way. And the type
here could just wrap a number and have a special value (or range of
values) to indicate problems - or it could be a compound type containing
status information and a reading. Or it could contain multiple
readings, or some kind of confidence indicator (perhaps showing whether
multiple physical sensors agree or disagree).

Or the "readsensors" function might handle problems itself, so that it
only returns valid values. Or you might have a different interface. Or
you might have a system where invalid readings are too unrealistic to
need consideration. Or you might use a separate function to check
validity of the sensors, independent of the "readsensors" function. Or
you might take the value as-is, and use it for the regulator, but have a
higher level function that checks the validity information before
sending the regulator code output to the actual electronics.

Trying to call all this a "kind of NaN" is just silly and highly unhelpful.

> Of course you could return a bool to indicate the there is no data rather than have
> something in oxygen_flow_t to mean the same thing, and there are various variations
> on the same theme. But there's esentially only one way to do it. Control returns to the caller,
> and "oxygen" is in scope. So if "oxygen" doesn't hold a number, we have to have a way
> of representing that.
> ( I know that you can fiddle about with longjmp() or other ways of not returning to caller,
> but they are difficult to implement and going against the language).
>
> In C++ we can do this
>
> oxygen_flow_t readsensors()
> {
> if (nodata())
> throw myexception::sensorfailure;
> return always_valid_value();
> }
>
> Now the code after the call is not executed unless the return value is valid. So we don't need
> a way of representing that an oxygen_flow_t doesn't hold a number, because it always does.
>

That still returns information to the caller - either a valid reading,
or some information about failures. (It does not use a NaN of any sort.)

Re: bart again (UCX64)

<udsp5t$274aa$2@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=45479&group=comp.lang.c#45479

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.brown@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Wed, 13 Sep 2023 18:49:01 +0200
Organization: A noiseless patient Spider
Lines: 41
Message-ID: <udsp5t$274aa$2@dont-email.me>
References: <1262755563@f172.n1.z21.fsxnet>
<87y1hhmehf.fsf@nosuchdomain.example.com> <20230907235623.619@kylheku.com>
<udeksu$3crce$1@dont-email.me>
<4945f15a-22dd-431e-a732-81ed36615f27n@googlegroups.com>
<udepd1$3dal1$2@dont-email.me>
<543b9acc-de99-425c-bb1d-485e9f98889dn@googlegroups.com>
<udf9jn$3fta8$1@dont-email.me>
<7cf7b6bd-39d9-4e22-baee-e128cfb2f214n@googlegroups.com>
<udk4a5$hkp5$1@dont-email.me>
<8238a0d7-aeb2-4b26-8b1d-611caa37049an@googlegroups.com>
<udmddn$v4e7$1@dont-email.me> <udmpuu$110jq$1@dont-email.me>
<8734zkspd5.fsf@bsb.me.uk>
<f7077ac4-908c-41e9-96a0-58cf9df4d494n@googlegroups.com>
<87ledcqrp0.fsf@bsb.me.uk> <udo4s3$17hu7$1@dont-email.me>
<87ledcp05z.fsf@bsb.me.uk>
<678354ed-d89c-4d45-adfd-1ded3d22eecan@googlegroups.com>
<87ttrzo1zm.fsf@bsb.me.uk>
<5e098055-c3bd-4f9c-984c-b4fdaf610adbn@googlegroups.com>
<877counnej.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 13 Sep 2023 16:49:01 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="51c48b399e73ee5caec2f0cf83b8ec11";
logging-data="2330954"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/PVYHvtWtt/vpF+TS3iXXQapk9/HHyHIo="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:P+IBGFXB8bgiD0doCnzmCqqLejw=
Content-Language: en-GB
In-Reply-To: <877counnej.fsf@bsb.me.uk>
 by: David Brown - Wed, 13 Sep 2023 16:49 UTC

On 13/09/2023 16:44, Ben Bacarisse wrote:
> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>
>> On Tuesday, 12 September 2023 at 16:17:18 UTC+1, Ben Bacarisse wrote:

>>> Why does this matter? Because it's just programming. There should be a
>>> specification where you have left a void for this mystery program. The
>>> life support system should be specified to provide timely and correct
>>> results to the oxygen valve or to stop in such a way to provoke other
>>> systems to trigger the alarms other wise.
>>>
>> It's specified to always control the flow of oxygen, based on various
>> readings it takes from sensors attached to the patient.
>
> That might be the first specification, but it will get revised at the
> first review before a line of code is written.
>
>> If it stops controlling the flow
>> of oxygen, that's very serious. The alarm goes off. The nurse should come.
>> But it's very much an emergency and undesired.
>
> It might be very much desired considering the alternatives. But the
> point is that something needs to stated so that we know what to
> implement. You might assume that any sane programmer will, in effect,
> be implementing my revised spec, but that's not how to do serious work.
>

Just as a point of interest, real systems like this are often specified
in a manner that would seem counter-intuitive to many.

A real oxygen regulation system would likely be specified as having "do
nothing" as its primary function. No output, no alarms, no oxygen
pressure. That would ensure that the lack of oxygen regulation would be
detected by higher up systems (since you don't have an "alarm on"
output, you have an "alarm off" output), that it would not injure a
patient by pumping high pressure oxygen, and it would not hinder medical
personnel from manually helping the patient.

Actually regulating the oxygen supply would be very much a secondary and
lower priority task for the system.

Re: bart again (UCX64)

<20230913100854.153@kylheku.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=45480&group=comp.lang.c#45480

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-4973@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Wed, 13 Sep 2023 17:12:23 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <20230913100854.153@kylheku.com>
References: <1262755563@f172.n1.z21.fsxnet>
<678354ed-d89c-4d45-adfd-1ded3d22eecan@googlegroups.com>
<87ttrzo1zm.fsf@bsb.me.uk>
<5e098055-c3bd-4f9c-984c-b4fdaf610adbn@googlegroups.com>
<DD0MM.39423$jJK6.35686@fx14.iad>
<647ac7a4-fb14-4072-b65f-5b20290a4b7bn@googlegroups.com>
<KN1MM.6185$Q73f.3452@fx48.iad>
<1ad9d75b-48bb-4b3a-93f0-92900479280en@googlegroups.com>
<uds4rb$23he0$1@dont-email.me>
<e837db60-7ae9-4aa6-b539-424b97579e4dn@googlegroups.com>
<udsach$24go6$1@dont-email.me> <60jMM.5116$quJ8.2754@fx18.iad>
<udsjcl$25tg7$1@dont-email.me>
Injection-Date: Wed, 13 Sep 2023 17:12:23 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ce777091f9fba6f7242e268c1845b936";
logging-data="2339715"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19xlhdbAldpU1wOLNZxq7JRTp1fsD03pBk="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:T3IXS/OOl3NJbBdPNP6dcaDDL0o=
 by: Kaz Kylheku - Wed, 13 Sep 2023 17:12 UTC

On 2023-09-13, James Kuyper <jameskuyper@alumni.caltech.edu> wrote:
> On 9/13/23 09:43, Scott Lurndal wrote:
> ...
>> Indeed, NaN is a term of art referring specifically to the IEEE
>> floating point standard. I've never seen "NaN" used in any
>> other context (albeit some use it to refer to their grandmother :-).
>
> Most general rules have at least one exception.
>
> The wikipedia article on NaNs points out that there is a private
> standard for something called posits, which are an alternative to IEEE
> 754. They have a similar concept NaR:="Not a Real", which differs from a
> NaN mainly in that NaRs compare equal to each other.

Speaking of which, I would prefer that NaN values compare equal
to themselves; i.e. if two operands are NaNs of the same bit pattern,
they compare equal. It's a repugnancy that they do not.

https://en.wikipedia.org/wiki/Law_of_identity

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

[meta] spam in thread

<a79640d9-9f08-4a7c-a16d-bf824c0ca3f5n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=45481&group=comp.lang.c#45481

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:ac8:5850:0:b0:412:2dac:acb8 with SMTP id h16-20020ac85850000000b004122dacacb8mr71442qth.3.1694629333419;
Wed, 13 Sep 2023 11:22:13 -0700 (PDT)
X-Received: by 2002:a9d:7d91:0:b0:6bd:cf64:d106 with SMTP id
j17-20020a9d7d91000000b006bdcf64d106mr958155otn.2.1694629333248; Wed, 13 Sep
2023 11:22:13 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Wed, 13 Sep 2023 11:22:12 -0700 (PDT)
In-Reply-To: <20230913100854.153@kylheku.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:f80b:22b8:3e99:4a5d;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:f80b:22b8:3e99:4a5d
References: <1262755563@f172.n1.z21.fsxnet> <678354ed-d89c-4d45-adfd-1ded3d22eecan@googlegroups.com>
<87ttrzo1zm.fsf@bsb.me.uk> <5e098055-c3bd-4f9c-984c-b4fdaf610adbn@googlegroups.com>
<DD0MM.39423$jJK6.35686@fx14.iad> <647ac7a4-fb14-4072-b65f-5b20290a4b7bn@googlegroups.com>
<KN1MM.6185$Q73f.3452@fx48.iad> <1ad9d75b-48bb-4b3a-93f0-92900479280en@googlegroups.com>
<uds4rb$23he0$1@dont-email.me> <e837db60-7ae9-4aa6-b539-424b97579e4dn@googlegroups.com>
<udsach$24go6$1@dont-email.me> <60jMM.5116$quJ8.2754@fx18.iad>
<udsjcl$25tg7$1@dont-email.me> <20230913100854.153@kylheku.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a79640d9-9f08-4a7c-a16d-bf824c0ca3f5n@googlegroups.com>
Subject: [meta] spam in thread
From: malcolm.arthur.mclean@gmail.com (Malcolm McLean)
Injection-Date: Wed, 13 Sep 2023 18:22:13 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1885
 by: Malcolm McLean - Wed, 13 Sep 2023 18:22 UTC

The newsgroup is suffering from a severe spam problem.
For the first time in the current blizzard, spam has been
injected into a legiitmate thread itself. Which will cause major
problems for me in filtering.

Re: [meta] spam in thread

<20230913113339.280@kylheku.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=45482&group=comp.lang.c#45482

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-4973@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: [meta] spam in thread
Date: Wed, 13 Sep 2023 18:40:28 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <20230913113339.280@kylheku.com>
References: <1262755563@f172.n1.z21.fsxnet>
<678354ed-d89c-4d45-adfd-1ded3d22eecan@googlegroups.com>
<87ttrzo1zm.fsf@bsb.me.uk>
<5e098055-c3bd-4f9c-984c-b4fdaf610adbn@googlegroups.com>
<DD0MM.39423$jJK6.35686@fx14.iad>
<647ac7a4-fb14-4072-b65f-5b20290a4b7bn@googlegroups.com>
<KN1MM.6185$Q73f.3452@fx48.iad>
<1ad9d75b-48bb-4b3a-93f0-92900479280en@googlegroups.com>
<uds4rb$23he0$1@dont-email.me>
<e837db60-7ae9-4aa6-b539-424b97579e4dn@googlegroups.com>
<udsach$24go6$1@dont-email.me> <60jMM.5116$quJ8.2754@fx18.iad>
<udsjcl$25tg7$1@dont-email.me> <20230913100854.153@kylheku.com>
<a79640d9-9f08-4a7c-a16d-bf824c0ca3f5n@googlegroups.com>
Injection-Date: Wed, 13 Sep 2023 18:40:28 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ce777091f9fba6f7242e268c1845b936";
logging-data="2367699"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18sEmXloYX7Qq7tjPer5H/5V/fTZlAbiDc="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:me0yFIBDWETs+hToqVSIeN9QfB0=
 by: Kaz Kylheku - Wed, 13 Sep 2023 18:40 UTC

On 2023-09-13, Malcolm McLean <malcolm.arthur.mclean@gmail.com> wrote:
> The newsgroup is suffering from a severe spam problem.
> For the first time in the current blizzard, spam has been
> injected into a legiitmate thread itself. Which will cause major
> problems for me in filtering.

The main reason you would be having problems filtering is that you're on
Google Groups, where not only does most of the spam originate, but where
you have next to no tools to deal with it.

I don't see a problem here. Everything coming from Google Groups is
killed, except for people on my whitelist, including yourself.

Two idiots from non-Google-group accounts recently started replying to
spam posts. They are turfed. I'm referring to <doctor@doctor.nl2k.ab.ca>
and <yeti@tilde.institute>. That's a minor problem.

Everything looks clean from slrn connected to Eternal September.
The only hint of spam is that the newsgroup might show, say, 31
unread posts, but when I select it, there are only 7.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

Re: [meta] spam in thread

<3cba66d2-c4a6-47a2-a2ce-9c31d8298027n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=45483&group=comp.lang.c#45483

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:569:b0:76d:9ee4:2b2b with SMTP id p9-20020a05620a056900b0076d9ee42b2bmr71720qkp.15.1694630906690;
Wed, 13 Sep 2023 11:48:26 -0700 (PDT)
X-Received: by 2002:a9d:4d0a:0:b0:6b7:4ec4:cbb1 with SMTP id
n10-20020a9d4d0a000000b006b74ec4cbb1mr918892otf.7.1694630906374; Wed, 13 Sep
2023 11:48:26 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Wed, 13 Sep 2023 11:48:25 -0700 (PDT)
In-Reply-To: <20230913113339.280@kylheku.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:f80b:22b8:3e99:4a5d;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:f80b:22b8:3e99:4a5d
References: <1262755563@f172.n1.z21.fsxnet> <678354ed-d89c-4d45-adfd-1ded3d22eecan@googlegroups.com>
<87ttrzo1zm.fsf@bsb.me.uk> <5e098055-c3bd-4f9c-984c-b4fdaf610adbn@googlegroups.com>
<DD0MM.39423$jJK6.35686@fx14.iad> <647ac7a4-fb14-4072-b65f-5b20290a4b7bn@googlegroups.com>
<KN1MM.6185$Q73f.3452@fx48.iad> <1ad9d75b-48bb-4b3a-93f0-92900479280en@googlegroups.com>
<uds4rb$23he0$1@dont-email.me> <e837db60-7ae9-4aa6-b539-424b97579e4dn@googlegroups.com>
<udsach$24go6$1@dont-email.me> <60jMM.5116$quJ8.2754@fx18.iad>
<udsjcl$25tg7$1@dont-email.me> <20230913100854.153@kylheku.com>
<a79640d9-9f08-4a7c-a16d-bf824c0ca3f5n@googlegroups.com> <20230913113339.280@kylheku.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3cba66d2-c4a6-47a2-a2ce-9c31d8298027n@googlegroups.com>
Subject: Re: [meta] spam in thread
From: malcolm.arthur.mclean@gmail.com (Malcolm McLean)
Injection-Date: Wed, 13 Sep 2023 18:48:26 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3136
 by: Malcolm McLean - Wed, 13 Sep 2023 18:48 UTC

On Wednesday, 13 September 2023 at 19:40:47 UTC+1, Kaz Kylheku wrote:
> On 2023-09-13, Malcolm McLean <malcolm.ar...@gmail.com> wrote:
> > The newsgroup is suffering from a severe spam problem.
> > For the first time in the current blizzard, spam has been
> > injected into a legiitmate thread itself. Which will cause major
> > problems for me in filtering.
> The main reason you would be having problems filtering is that you're on
> Google Groups, where not only does most of the spam originate, but where
> you have next to no tools to deal with it.
>
> I don't see a problem here. Everything coming from Google Groups is
> killed, except for people on my whitelist, including yourself.
>
> Two idiots from non-Google-group accounts recently started replying to
> spam posts. They are turfed. I'm referring to <doc...@doctor.nl2k.ab.ca>
> and <ye...@tilde.institute>. That's a minor problem.
>
> Everything looks clean from slrn connected to Eternal September.
> The only hint of spam is that the newsgroup might show, say, 31
> unread posts, but when I select it, there are only 7.
>
I might have to move to a newsreader. I did use one before Google groups
was invented.
But I've only room for one computer, and so it has to be the computer provided
by work. And I'm a bit reluctant to put lots of non-work software on it.

Re: bart again (UCX64)

<871qf1oq86.fsf@bsb.me.uk>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=45484&group=comp.lang.c#45484

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Wed, 13 Sep 2023 19:58:01 +0100
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <871qf1oq86.fsf@bsb.me.uk>
References: <1262755563@f172.n1.z21.fsxnet>
<678354ed-d89c-4d45-adfd-1ded3d22eecan@googlegroups.com>
<87ttrzo1zm.fsf@bsb.me.uk>
<5e098055-c3bd-4f9c-984c-b4fdaf610adbn@googlegroups.com>
<DD0MM.39423$jJK6.35686@fx14.iad>
<647ac7a4-fb14-4072-b65f-5b20290a4b7bn@googlegroups.com>
<KN1MM.6185$Q73f.3452@fx48.iad>
<1ad9d75b-48bb-4b3a-93f0-92900479280en@googlegroups.com>
<uds4rb$23he0$1@dont-email.me>
<e837db60-7ae9-4aa6-b539-424b97579e4dn@googlegroups.com>
<udsach$24go6$1@dont-email.me> <60jMM.5116$quJ8.2754@fx18.iad>
<udsjcl$25tg7$1@dont-email.me> <20230913100854.153@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="d402efe92178590df0c731029dbf3024";
logging-data="2375656"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18IUizD6dFniDd/4qLPeF2D+r1g3+duYhM="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:3LigmEd3GZxej0NddQc8IzLmaUc=
sha1:kMaYPa3BK0QOixNqXGFJvDJ0cEU=
X-BSB-Auth: 1.fbf99414216d836039e3.20230913195801BST.871qf1oq86.fsf@bsb.me.uk
 by: Ben Bacarisse - Wed, 13 Sep 2023 18:58 UTC

Kaz Kylheku <864-117-4973@kylheku.com> writes:

> On 2023-09-13, James Kuyper <jameskuyper@alumni.caltech.edu> wrote:
>> On 9/13/23 09:43, Scott Lurndal wrote:
>> ...
>>> Indeed, NaN is a term of art referring specifically to the IEEE
>>> floating point standard. I've never seen "NaN" used in any
>>> other context (albeit some use it to refer to their grandmother :-).
>>
>> Most general rules have at least one exception.
>>
>> The wikipedia article on NaNs points out that there is a private
>> standard for something called posits, which are an alternative to IEEE
>> 754. They have a similar concept NaR:="Not a Real", which differs from a
>> NaN mainly in that NaRs compare equal to each other.
>
> Speaking of which, I would prefer that NaN values compare equal
> to themselves; i.e. if two operands are NaNs of the same bit pattern,
> they compare equal.

You can always (as of course you know) fall back on memcmp.

> It's a repugnancy that they do not.

Though it used to be very handy since n != n could test for a NaN.

--
Ben.

Re: [meta] spam in thread

<udt0ui$28fot$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=45485&group=comp.lang.c#45485

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.brown@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: [meta] spam in thread
Date: Wed, 13 Sep 2023 21:01:38 +0200
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <udt0ui$28fot$1@dont-email.me>
References: <1262755563@f172.n1.z21.fsxnet>
<678354ed-d89c-4d45-adfd-1ded3d22eecan@googlegroups.com>
<87ttrzo1zm.fsf@bsb.me.uk>
<5e098055-c3bd-4f9c-984c-b4fdaf610adbn@googlegroups.com>
<DD0MM.39423$jJK6.35686@fx14.iad>
<647ac7a4-fb14-4072-b65f-5b20290a4b7bn@googlegroups.com>
<KN1MM.6185$Q73f.3452@fx48.iad>
<1ad9d75b-48bb-4b3a-93f0-92900479280en@googlegroups.com>
<uds4rb$23he0$1@dont-email.me>
<e837db60-7ae9-4aa6-b539-424b97579e4dn@googlegroups.com>
<udsach$24go6$1@dont-email.me> <60jMM.5116$quJ8.2754@fx18.iad>
<udsjcl$25tg7$1@dont-email.me> <20230913100854.153@kylheku.com>
<a79640d9-9f08-4a7c-a16d-bf824c0ca3f5n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 13 Sep 2023 19:01:38 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1bcebe8d361398b826a068e3164047c5";
logging-data="2375453"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/XIGX66xRfLmHjC6wLPiExdKRGwIPGrNA="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:36wXcIu6ux87Y3rEi/cZRM4wB2M=
In-Reply-To: <a79640d9-9f08-4a7c-a16d-bf824c0ca3f5n@googlegroups.com>
Content-Language: en-GB
 by: David Brown - Wed, 13 Sep 2023 19:01 UTC

On 13/09/2023 20:22, Malcolm McLean wrote:
> The newsgroup is suffering from a severe spam problem.
> For the first time in the current blizzard, spam has been
> injected into a legiitmate thread itself. Which will cause major
> problems for me in filtering.
>

There have been a few spam messages sent as replies in valid threads -
this is not the first one in recent times, though most have been as the
start of new threads.

Spam is a PITA. It all comes from google groups posters, which is why
some people simply filter out everything from GG. Filter rules or
killfiles in real newsreaders makes it a bit more manageable, but still
highly annoying.

Re: bart again (UCX64)

<87v8cdn9bk.fsf@bsb.me.uk>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=45486&group=comp.lang.c#45486

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!rocksolid2!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Wed, 13 Sep 2023 20:48:31 +0100
Organization: A noiseless patient Spider
Lines: 56
Message-ID: <87v8cdn9bk.fsf@bsb.me.uk>
References: <1262755563@f172.n1.z21.fsxnet> <20230907235623.619@kylheku.com>
<udeksu$3crce$1@dont-email.me>
<4945f15a-22dd-431e-a732-81ed36615f27n@googlegroups.com>
<udepd1$3dal1$2@dont-email.me>
<543b9acc-de99-425c-bb1d-485e9f98889dn@googlegroups.com>
<udf9jn$3fta8$1@dont-email.me>
<7cf7b6bd-39d9-4e22-baee-e128cfb2f214n@googlegroups.com>
<udk4a5$hkp5$1@dont-email.me>
<8238a0d7-aeb2-4b26-8b1d-611caa37049an@googlegroups.com>
<udmddn$v4e7$1@dont-email.me> <udmpuu$110jq$1@dont-email.me>
<8734zkspd5.fsf@bsb.me.uk>
<f7077ac4-908c-41e9-96a0-58cf9df4d494n@googlegroups.com>
<87ledcqrp0.fsf@bsb.me.uk> <udo4s3$17hu7$1@dont-email.me>
<87ledcp05z.fsf@bsb.me.uk>
<678354ed-d89c-4d45-adfd-1ded3d22eecan@googlegroups.com>
<87ttrzo1zm.fsf@bsb.me.uk> <udq3ip$1kqr9$1@dont-email.me>
<87cyymntcg.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="d402efe92178590df0c731029dbf3024";
logging-data="2390158"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/LeJ8lge6JS5RoohGAnPl7trXFfwz9vaQ="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:G4RqCLe7cEhztrwKZ07/WNmS8Zg=
sha1:Dg+T/BS6DKqm6yFzDGiMadnZGSc=
X-BSB-Auth: 1.ec9281e2bd8c3eae7015.20230913204831BST.87v8cdn9bk.fsf@bsb.me.uk
 by: Ben Bacarisse - Wed, 13 Sep 2023 19:48 UTC

Ben Bacarisse <ben.usenet@bsb.me.uk> writes:

> Bart <bc@freeuk.com> writes:
>
>> On 12/09/2023 16:17, Ben Bacarisse wrote:
>>> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>>>
>>
>>>> No we can't use Haskell.
>>> That's a shame. The Glasgow Haskell compiler reports that in
>>> sign :: Double -> Int
>>> sign x | x < 0 = -1
>>> | x == 0 = 0
>>> | x > 0 = 1
>>> the guards are non-exhaustive.
>>
>> You can do a much simpler check in any language that doesn't need clever
>> analysis or knowledge of the special properties of NaNs.
>>
>> Because the last return/last value is conditional, it can fail, but there
>> is no value associated with that failing path.
>
> But that is not always true. Multiple conditions can be exhaustive.
> For example, Malcolm's sign:
>
> double sign(double x)
> {
> if ( x < 0 ) return -1;
> if ( x == 0 ) return 0;
> if ( x > 0 ) return 1;
> if (isnan(x)) return x;
> }
>
>> That can [be] provided in various ways including an 'else' branch of an
>> if-else-if chain.
>
> I think you are suggesting that a non-explicit "catch-all" should be

Some kind of auto-correct going on there: "an explicit catch-all" not a
non-explicit one.

> given to make the compiler's job easier. It maybe desirable from the
> point of view of controlling diagnostics but the result is less clear so
> I think it calls for a comment or even an assertion:
>
> double sign(double x)
> {
> if (x < 0) return -1;
> if (x == 0) return 0;
> if (x > 0) return 1;
> assert(isnan(x)); // all that's left...
> return x;
> }

--
Ben.

Re: bart again (UCX64)

<87pm2ln4d9.fsf@bsb.me.uk>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=45487&group=comp.lang.c#45487

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Wed, 13 Sep 2023 22:35:30 +0100
Organization: A noiseless patient Spider
Lines: 195
Message-ID: <87pm2ln4d9.fsf@bsb.me.uk>
References: <1262755563@f172.n1.z21.fsxnet> <udeksu$3crce$1@dont-email.me>
<4945f15a-22dd-431e-a732-81ed36615f27n@googlegroups.com>
<udepd1$3dal1$2@dont-email.me>
<543b9acc-de99-425c-bb1d-485e9f98889dn@googlegroups.com>
<udf9jn$3fta8$1@dont-email.me>
<7cf7b6bd-39d9-4e22-baee-e128cfb2f214n@googlegroups.com>
<udk4a5$hkp5$1@dont-email.me>
<8238a0d7-aeb2-4b26-8b1d-611caa37049an@googlegroups.com>
<udmddn$v4e7$1@dont-email.me> <udmpuu$110jq$1@dont-email.me>
<8734zkspd5.fsf@bsb.me.uk>
<f7077ac4-908c-41e9-96a0-58cf9df4d494n@googlegroups.com>
<87ledcqrp0.fsf@bsb.me.uk> <udo4s3$17hu7$1@dont-email.me>
<87ledcp05z.fsf@bsb.me.uk>
<678354ed-d89c-4d45-adfd-1ded3d22eecan@googlegroups.com>
<87ttrzo1zm.fsf@bsb.me.uk>
<5e098055-c3bd-4f9c-984c-b4fdaf610adbn@googlegroups.com>
<877counnej.fsf@bsb.me.uk>
<10516060-07d5-4914-a389-4d16f7de696an@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="d402efe92178590df0c731029dbf3024";
logging-data="2423180"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18lr2eLrheVljGeI9B0DY+dr7YmYbe2v3M="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:JMnH3i2qguSVMn5cyiXNBPEe9bE=
sha1:fyT4vCNOim4lopIzOF2jJAV7G0o=
X-BSB-Auth: 1.c065919e9b67220c78b2.20230913223530BST.87pm2ln4d9.fsf@bsb.me.uk
 by: Ben Bacarisse - Wed, 13 Sep 2023 21:35 UTC

Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

I'm going to skip to the parts that I feel I can get some purchase on...

>> > sign() has a core domain which includes all the real numbers. You
>> > might know that none of the reals in the program can be lower than
>> > unity. But you can't sensibly trap such numbers and still call the
>> > function sign(). NaN isn't in the core domain. We can sensibly say
>> > that sing(NaN) is NaN, or at a stretch, even 0. But we can also say
>> > that calling sign with NaN is to be considered a programming error.

> On Wednesday, 13 September 2023 at 15:44:37 UTC+1, Ben Bacarisse wrote:

>> I really, genuinely, have no idea what your point it. You appear to
>> describing the basics of how one writes code, informally, with no clear
>> objectives in mind. We could this, we could that: NaNs are in the
>> domain but not in the core domain. We could return NaN or 0 or trap a
>> programming error if one is passed.
>>
> The spec is int sign(double x) return -1 if x is negative, 1 if x is positive,
> and 0 if x is zero.
> Any function which obeys that specification can legitimately be called
> "sign".
> So int sign( return x/fabs(x);} would not be sign(), because 0 isn't being
> handled correctly. return x ? x/fabs(x) : 0; would however be sign(). It won't
> work for infinities, but they aren't in the core domain.
> Similarly
> int sign(double x)
> {
> if (isnan(x))
> return 2;
> ....
> }
>
> is sign(). NaN isn't in the core doman of sign(). We can legitimately say that
> "calling sign() with NaN is undefined". Nowever NaN is is the domain of sign(),
> just as infinites are. The sign of not-a-number is surely not a number. But we
> dont have to handle all the odd cases to implement what we can reasonably
> term "the function sign()".
> Now if we know that NaNs can only be passed to sign() as the result of a
> programming error, we can exploit this to trap the errors. If isnan(x),
> print out various diagnostic messages.
>
> However lets say that, in our program, we know that not only must a NaN represent
> a programing error. No real value can go out of the range -100 to 100. If it does,
> that must also be a bug.
> So can we write
>
> int sign(double x)
> {
> if (x < -100 || x > 100)
> abort();
> }
>
> Thje answer is, no we can't. -101 is in the core domain of sign(). If we don't return
> -1 ofr it, we should no longer call the function sign().

I started to reply to some of this but I had to keep picking my jaw up
from the ground. What is this company? How do they hire programmers?
What processes do they have for ensuring code quality?

I suspect the trouble here is you are not playing this game properly.
It's a made-up scenario, but we (you and I) have to play as if it were.
That would mean I could reasonably step in above and say that, as
manager or reviewer, the "spec" for sign(x) would have been rejected out
of hand. For one thing, "negative" is clearly ambiguous and "is" should
generally be avoided in any function using floating point.

Now, for small functions, the code can be taken to be the spec, and
provided there was good internal documentation (just a few lines of
comment about it oddly not covering the argument domain) I would accept
the rather odd code you first posted but I'd insist on an assert at the
top for testing. But since we need this function to get accepted
without that, let's assume I was holiday and the reviewer did not insist
on the assert.

By the way, I try to use "we" only when I an referring to the
participants in a conversation. For the record, almost nothing you
wrote above that used "we" includes me.

>> I am happy to stick with rather artificial examples, but you are not
>> getting to the point. What is the bug? Does the code somehow magic up
>> NaNs and if so from where? Do you agree that one bug can produce many
>> different behaviours and at different times? Do you accept that the
>> specification should say what happens when the sensors fail, or the
>> correct operation can no longer be guaranteed? This discussion feels
>> like nailing a jelly to the fence.
>>
> In this case, the sensor had no data. So readsensors() returned NaN,
> as it was specified to do. And there is a function called
> handlesensorfailure() which is designed to cope with this
> situation. So correct code is to branch on the return result, and if
> it is NaN, call the function which copes with no data. If it is not
> Nan, call sign() with the result to decide whether to increase or
> decrease the oxygen flow. Simple, unexceptional, non-contrived
> requirements.
>
> Unfortunately, in this case, the programmer was asleep, and instead of
> writing
> if (isnan(sensor_value))
> handlesensorfailure();
> else
> delta_oxygen_output = sign(sensor_value) * step;
>
> he wrote
>
> if (sensor_value == NaN)
> handlesensorfailure();
> else
> delta_oxygen_value = sign(sensor_value) * step;
>
> Now obviously the intellectually challenged will say "that bug could
> never occur in a safety citical enviornment". And they may well be
> right. So make it the same underlying mistake but more subtle. These
> things can and do occur.

Did this code pass code review? Did the reviewer see the results of the
unit tests? Are they all interns? Does the team need to hold it's hand
up and admit that this product won't be ready as everyone from the
project manager down needs to go on a few basic training courses?

> The question is how to write sign().

Is it? Why is that the question? Sign has been specified for normal
numbers, subnormal numbers, signed zeros and infinities. It's fine
(though peculiar). You don't go fixing a bug in one place by changing
agreed and working code elsewhere.

Actually question is how can the team be trained in writing unit tests
before the company is sued into oblivion.

> It is called only once in the program. It can never
> be passed a NaN. In the plan. In reality, it is passed a NaN.

It is specified, documented and working. I would not advise changing
it.

But I don't know how we got to this point in the game. Has the bug been
found yet? If so, why is changing 'sign' even being considered? And if
it has not been found, why is changing 'sign' even being considered?
(You might want to delay answering this until later as I ask the same
question again in relation to processes.)

>> > Similar errors do make their way into critical systems where the costs are
>> > extremely high, like spacecraft, and there have been reports.
>> Yes. But what are you proposing to do about it that you think differs
>> from my methods? My proposal is simple to state: minimise the chance of
>> errors in the program; that is cases where the program might not behave
>> as specified.
>>
> Your method is to wave a magic wand and make the error go away.

Absolutely not. It's not magic. It's about well-written specs, good
internal documentation, thorough unit tests, careful code review, sound
integration tests and rigorous code management. But a problem has
slipped through because I was away and someone did not insist on a
function asserting its pre-conditions during testing.

> And of course it should be caught by testing.

It /will/ be found in testing. You can't wave your hand and say
"imagine there's a bug that did not get found in testing" because
although we know such things do occur, to discuss what can be done about
them we need a plausible example.

> In fact the compiler
> should warn. But however rigorous your testing, however carefully you
> adhere to your formal methods, reality is that the ocasional error
> like this will slip throuhg the net. The actual example is maybe a bit
> too crude, but it's easy enough to make it more subtle, without really
> adding anything to the discussion.

We need an example, because without it, I can't see why this team is
going to change sign. The mistake will be found at the very first unit
test and fixed before anyone else even notices (lucky programmer!).

You are trying to have it both ways. To ensure you can reasonably
change 'sign' you need it to be called in only one place, but that also
means there are trivial tests that will spot any error before the call.

> So my method is to say "are we running a video game or a life support
> system?". If the answer is a video game, then I would write sign(NaN)
> to return 0. Plough on and hope that the error is masked. If the
> answer is a life support system, I would say "set off the alarm at
> this point".


Click here to read the complete article
Re: bart again (UCX64)

<861qevmfym.fsf@linuxsc.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=45531&group=comp.lang.c#45531

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17687@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Mon, 18 Sep 2023 12:36:17 -0700
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <861qevmfym.fsf@linuxsc.com>
References: <1262755563@f172.n1.z21.fsxnet> <678354ed-d89c-4d45-adfd-1ded3d22eecan@googlegroups.com> <87ttrzo1zm.fsf@bsb.me.uk> <5e098055-c3bd-4f9c-984c-b4fdaf610adbn@googlegroups.com> <DD0MM.39423$jJK6.35686@fx14.iad> <647ac7a4-fb14-4072-b65f-5b20290a4b7bn@googlegroups.com> <KN1MM.6185$Q73f.3452@fx48.iad> <1ad9d75b-48bb-4b3a-93f0-92900479280en@googlegroups.com> <uds4rb$23he0$1@dont-email.me> <e837db60-7ae9-4aa6-b539-424b97579e4dn@googlegroups.com> <udsach$24go6$1@dont-email.me> <60jMM.5116$quJ8.2754@fx18.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="eea9b3fa2266531b102f184a126e7979";
logging-data="2024378"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19VGlimyU6/qvZ1c4A5N/B27msPqIYrGlc="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:unPTcHh8+TiBpGtmiO8aPQNRNIo=
sha1:PBzHvHB7vWc691sios/kd4uPEC8=
 by: Tim Rentsch - Mon, 18 Sep 2023 19:36 UTC

scott@slp53.sl.home (Scott Lurndal) writes:

> NaN is a term of art referring specifically to the IEEE
> floating point standard. I've never seen "NaN" used in any
> other context (albeit some use it to refer to their grandmother :-).

The C standard uses (and also defines) the word NaN as a generic
term applicable to floating-point representations in general. In
section 5.2.4.2.2 paragraph 3, the C standard says this

A /NaN/ is an encoding signifying Not-a-Number.

with the slant characters meaning italics, which indicates a
definition. The same paragraph gives generic definitions for
the more specialized terms "quiet NaN" and "signaling NaN".

There is a footnote that mentions the IEEE floating-point
standard, but makes clear that terms for the various kinds of NaN
can refer to values in other floating-point systems that have
similar behavior.

Re: bart again (UCX64)

<87edivkyfu.fsf@nosuchdomain.example.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=45534&group=comp.lang.c#45534

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Mon, 18 Sep 2023 13:40:05 -0700
Organization: None to speak of
Lines: 39
Message-ID: <87edivkyfu.fsf@nosuchdomain.example.com>
References: <1262755563@f172.n1.z21.fsxnet>
<678354ed-d89c-4d45-adfd-1ded3d22eecan@googlegroups.com>
<87ttrzo1zm.fsf@bsb.me.uk>
<5e098055-c3bd-4f9c-984c-b4fdaf610adbn@googlegroups.com>
<DD0MM.39423$jJK6.35686@fx14.iad>
<647ac7a4-fb14-4072-b65f-5b20290a4b7bn@googlegroups.com>
<KN1MM.6185$Q73f.3452@fx48.iad>
<1ad9d75b-48bb-4b3a-93f0-92900479280en@googlegroups.com>
<uds4rb$23he0$1@dont-email.me>
<e837db60-7ae9-4aa6-b539-424b97579e4dn@googlegroups.com>
<udsach$24go6$1@dont-email.me> <60jMM.5116$quJ8.2754@fx18.iad>
<861qevmfym.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="429dd8307f13cb680980e2c637354176";
logging-data="2047743"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19k51IfaBg34/D4KkvV92Ap"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:zEIBTPjmA2U/Lh8CmrlTUg4Wj1s=
sha1:cMKI2J4ft9wReh20nO6xOSiLST8=
 by: Keith Thompson - Mon, 18 Sep 2023 20:40 UTC

Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
> scott@slp53.sl.home (Scott Lurndal) writes:
>> NaN is a term of art referring specifically to the IEEE
>> floating point standard. I've never seen "NaN" used in any
>> other context (albeit some use it to refer to their grandmother :-).
>
> The C standard uses (and also defines) the word NaN as a generic
> term applicable to floating-point representations in general. In
> section 5.2.4.2.2 paragraph 3, the C standard says this
>
> A /NaN/ is an encoding signifying Not-a-Number.
>
> with the slant characters meaning italics, which indicates a
> definition. The same paragraph gives generic definitions for
> the more specialized terms "quiet NaN" and "signaling NaN".
>
> There is a footnote that mentions the IEEE floating-point
> standard, but makes clear that terms for the various kinds of NaN
> can refer to values in other floating-point systems that have
> similar behavior.

Agreed, the C standard is careful not to assume that floating-point
systems other than IEEE do or do not have NaNs.

In the real world, as far as I can tell, IEEE happens to be the
only floating-point system that has NaNs. IEEE introduced NaNs
in 1985, and the introduction of the IEEE standard inhibited the
creation of other floating-point formats. (That's not *quite*
true; apparently at least some implementations of "posits" provide
NaNs. But I don't think any C implementation uses posits as its
floating-point representation, and it might not be possible for a
conforming implementation to do so.)

"IEEE" is of course a common shorthand for "IEEE 754".

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: bart again (UCX64)

<86wmwml5e3.fsf@linuxsc.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=45564&group=comp.lang.c#45564

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17687@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Tue, 19 Sep 2023 05:22:12 -0700
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <86wmwml5e3.fsf@linuxsc.com>
References: <1262755563@f172.n1.z21.fsxnet> <udeksu$3crce$1@dont-email.me> <4945f15a-22dd-431e-a732-81ed36615f27n@googlegroups.com> <udepd1$3dal1$2@dont-email.me> <543b9acc-de99-425c-bb1d-485e9f98889dn@googlegroups.com> <udf9jn$3fta8$1@dont-email.me> <7cf7b6bd-39d9-4e22-baee-e128cfb2f214n@googlegroups.com> <udk4a5$hkp5$1@dont-email.me> <8238a0d7-aeb2-4b26-8b1d-611caa37049an@googlegroups.com> <udmddn$v4e7$1@dont-email.me> <udmpuu$110jq$1@dont-email.me> <8734zkspd5.fsf@bsb.me.uk> <f7077ac4-908c-41e9-96a0-58cf9df4d494n@googlegroups.com> <87ledcqrp0.fsf@bsb.me.uk> <udo4s3$17hu7$1@dont-email.me> <87ledcp05z.fsf@bsb.me.uk> <678354ed-d89c-4d45-adfd-1ded3d22eecan@googlegroups.com> <87ttrzo1zm.fsf@bsb.me.uk> <udq3ip$1kqr9$1@dont-email.me> <udqcu3$1milh$1@dont-email.me> <87o7i6ompu.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="2708376e434a174750b1cbd4a8683397";
logging-data="2463718"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+2j4OvJsE0bp9wqz8TuWyXAGhjvM52yto="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:AEDoT5cOernoWssxBcS8cg9p9xk=
sha1:Jw6iBcC78m1bVKE9/7r9UTexY/Y=
 by: Tim Rentsch - Tue, 19 Sep 2023 12:22 UTC

Ben Bacarisse <ben.usenet@bsb.me.uk> writes:

> David Brown <david.brown@hesbynett.no> writes:
>
>> On 12/09/2023 18:28, Bart wrote:
>>
>>> On 12/09/2023 16:17, Ben Bacarisse wrote:
>>>
>>>> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>>>>
>>>>> No we can't use Haskell.
>>>>
>>>> That's a shame. The Glasgow Haskell compiler reports that in
>>>>
>>>> sign :: Double -> Int
>>>> sign x | x < 0 = -1
>>>> | x == 0 = 0
>>>> | x > 0 = 1
>>>>
>>>> the guards are non-exhaustive.
>>
>> To be fair, it will also give the same warning if you replace
>> "Double" with "Int".
>
> Well that's disappointing. I thought it was doing a more interesting
> analysis that would exclude such false positives. I must never have
> written a set of guards that was not obviously exhaustive.
>
> You do of course get a run-time error if you call sign with a NaN.

When you say there is a run-time error you mean an exception
is raised, yes? And the exception can be caught and dealt
with by code somewhere up the call chain?

Re: bart again (UCX64)

<86sf7al3xh.fsf@linuxsc.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=45565&group=comp.lang.c#45565

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17687@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Tue, 19 Sep 2023 05:53:46 -0700
Organization: A noiseless patient Spider
Lines: 72
Message-ID: <86sf7al3xh.fsf@linuxsc.com>
References: <1262755563@f172.n1.z21.fsxnet> <20230907235623.619@kylheku.com> <udeksu$3crce$1@dont-email.me> <4945f15a-22dd-431e-a732-81ed36615f27n@googlegroups.com> <udepd1$3dal1$2@dont-email.me> <543b9acc-de99-425c-bb1d-485e9f98889dn@googlegroups.com> <udf9jn$3fta8$1@dont-email.me> <7cf7b6bd-39d9-4e22-baee-e128cfb2f214n@googlegroups.com> <udk4a5$hkp5$1@dont-email.me> <8238a0d7-aeb2-4b26-8b1d-611caa37049an@googlegroups.com> <udmddn$v4e7$1@dont-email.me> <udmpuu$110jq$1@dont-email.me> <8734zkspd5.fsf@bsb.me.uk> <f7077ac4-908c-41e9-96a0-58cf9df4d494n@googlegroups.com> <87ledcqrp0.fsf@bsb.me.uk> <udo4s3$17hu7$1@dont-email.me> <87ledcp05z.fsf@bsb.me.uk> <678354ed-d89c-4d45-adfd-1ded3d22eecan@googlegroups.com> <87ttrzo1zm.fsf@bsb.me.uk> <udq3ip$1kqr9$1@dont-email.me> <87cyymntcg.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="2708376e434a174750b1cbd4a8683397";
logging-data="2482022"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/cNLQRL0e4HOuGp+mMz6I+l5zu3dIYi40="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:d3Xw0KtrfhhGdWL8i4b3hKFhgqk=
sha1:/0GjbOXSvi4//VAC2eMCHKawas0=
 by: Tim Rentsch - Tue, 19 Sep 2023 12:53 UTC

Ben Bacarisse <ben.usenet@bsb.me.uk> writes:

> Bart <bc@freeuk.com> writes:
>
>> On 12/09/2023 16:17, Ben Bacarisse wrote:
>>
>>> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>>>
>>>> No we can't use Haskell.
>>>
>>> That's a shame. The Glasgow Haskell compiler reports that in
>>> sign :: Double -> Int
>>> sign x | x < 0 = -1
>>> | x == 0 = 0
>>> | x > 0 = 1
>>> the guards are non-exhaustive.
>>
>> You can do a much simpler check in any language that doesn't need
>> clever analysis or knowledge of the special properties of NaNs.
>>
>> Because the last return/last value is conditional, it can fail, but
>> there is no value associated with that failing path.
>
> But that is not always true. Multiple conditions can be exhaustive.
> For example, Malcolm's sign:
>
> double sign(double x)
> {
> if ( x < 0 ) return -1;
> if ( x == 0 ) return 0;
> if ( x > 0 ) return 1;
> if (isnan(x)) return x;
> }
>
>> That can [be] provided in various ways including an 'else' branch
>> of an if-else-if chain.
>
> I think you are suggesting that [an explicit] "catch-all" should be
> given to make the compiler's job easier. It maybe desirable from
> the point of view of controlling diagnostics but the result is less
> clear so I think it calls for a comment or even an assertion:
>
> double sign(double x)
> {
> if (x < 0) return -1;
> if (x == 0) return 0;
> if (x > 0) return 1;
> assert(isnan(x)); // all that's left...
> return x;
> }

I agree with your sentiment about not worrying about making the
compiler's job easier. For the code, though, I think it's better
to preserve the symmetry of the case tests, and put in a final
failure call - not to make the compiler's job easier, but to make
the intent more apparent to a human reader. An assert() in place
of the final line would do the job instead, except that assert()
calls might be disabled by setting the macro NDEBUG.

double sign(double x)
{
if (isnan(x)) return x;
if (x < 0 ) return -1;
if (x == 0 ) return 0;
if (x > 0 ) return 1;
print_error_message_and_quit( "..whatever.." );
}

Incidentally, putting the test for isnan(x) first allows the
function to work with signaling NaNs as well as quiet NaNs.
(I confess that I don't know if comparing a signaling NaN
to zero gives rise to a program exception.)

Re: bart again (UCX64)

<878r92i957.fsf@bsb.me.uk>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=45566&group=comp.lang.c#45566

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Tue, 19 Sep 2023 14:29:24 +0100
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <878r92i957.fsf@bsb.me.uk>
References: <1262755563@f172.n1.z21.fsxnet>
<4945f15a-22dd-431e-a732-81ed36615f27n@googlegroups.com>
<udepd1$3dal1$2@dont-email.me>
<543b9acc-de99-425c-bb1d-485e9f98889dn@googlegroups.com>
<udf9jn$3fta8$1@dont-email.me>
<7cf7b6bd-39d9-4e22-baee-e128cfb2f214n@googlegroups.com>
<udk4a5$hkp5$1@dont-email.me>
<8238a0d7-aeb2-4b26-8b1d-611caa37049an@googlegroups.com>
<udmddn$v4e7$1@dont-email.me> <udmpuu$110jq$1@dont-email.me>
<8734zkspd5.fsf@bsb.me.uk>
<f7077ac4-908c-41e9-96a0-58cf9df4d494n@googlegroups.com>
<87ledcqrp0.fsf@bsb.me.uk> <udo4s3$17hu7$1@dont-email.me>
<87ledcp05z.fsf@bsb.me.uk>
<678354ed-d89c-4d45-adfd-1ded3d22eecan@googlegroups.com>
<87ttrzo1zm.fsf@bsb.me.uk> <udq3ip$1kqr9$1@dont-email.me>
<udqcu3$1milh$1@dont-email.me> <87o7i6ompu.fsf@bsb.me.uk>
<86wmwml5e3.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="95e4e89f3e4548c156f5ca76b6d747da";
logging-data="2495896"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/rn7tSS9DbJUjw/fzaF93a2R9jhDwNMQU="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:u4c/T2E7MjpgjWHeZdC8p+VTqCE=
sha1:iSiAJKZOHyCDzszD308ADH30+3s=
X-BSB-Auth: 1.b017c34a5bf5be71a1a7.20230919142925BST.878r92i957.fsf@bsb.me.uk
 by: Ben Bacarisse - Tue, 19 Sep 2023 13:29 UTC

Tim Rentsch <tr.17687@z991.linuxsc.com> writes:

> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>
>> David Brown <david.brown@hesbynett.no> writes:
>>
>>> On 12/09/2023 18:28, Bart wrote:
>>>
>>>> On 12/09/2023 16:17, Ben Bacarisse wrote:
>>>>
>>>>> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>>>>>
>>>>>> No we can't use Haskell.
>>>>>
>>>>> That's a shame. The Glasgow Haskell compiler reports that in
>>>>>
>>>>> sign :: Double -> Int
>>>>> sign x | x < 0 = -1
>>>>> | x == 0 = 0
>>>>> | x > 0 = 1
>>>>>
>>>>> the guards are non-exhaustive.
>>>
>>> To be fair, it will also give the same warning if you replace
>>> "Double" with "Int".
>>
>> Well that's disappointing. I thought it was doing a more interesting
>> analysis that would exclude such false positives. I must never have
>> written a set of guards that was not obviously exhaustive.
>>
>> You do of course get a run-time error if you call sign with a NaN.
>
> When you say there is a run-time error you mean an exception
> is raised, yes? And the exception can be caught and dealt
> with by code somewhere up the call chain?

Yes.

--
Ben.

Re: bart again (UCX64)

<86zg1gjlf5.fsf@linuxsc.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=45596&group=comp.lang.c#45596

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17687@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Wed, 20 Sep 2023 19:43:26 -0700
Organization: A noiseless patient Spider
Lines: 53
Message-ID: <86zg1gjlf5.fsf@linuxsc.com>
References: <1262755563@f172.n1.z21.fsxnet> <678354ed-d89c-4d45-adfd-1ded3d22eecan@googlegroups.com> <87ttrzo1zm.fsf@bsb.me.uk> <5e098055-c3bd-4f9c-984c-b4fdaf610adbn@googlegroups.com> <DD0MM.39423$jJK6.35686@fx14.iad> <647ac7a4-fb14-4072-b65f-5b20290a4b7bn@googlegroups.com> <KN1MM.6185$Q73f.3452@fx48.iad> <1ad9d75b-48bb-4b3a-93f0-92900479280en@googlegroups.com> <uds4rb$23he0$1@dont-email.me> <e837db60-7ae9-4aa6-b539-424b97579e4dn@googlegroups.com> <udsach$24go6$1@dont-email.me> <60jMM.5116$quJ8.2754@fx18.iad> <861qevmfym.fsf@linuxsc.com> <87edivkyfu.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="6bb9a84091d3c126c92249d4c2964ff3";
logging-data="3508796"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18xODqMpj7Zxf8Jhjt7c3WK/1gQu9JTYzE="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:D5yE37WcNVb26Gn1vLgrgcEef4c=
sha1:ugp4MdnrUtDqHkZcYAFjOFCV/mU=
 by: Tim Rentsch - Thu, 21 Sep 2023 02:43 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>
>> scott@slp53.sl.home (Scott Lurndal) writes:
>>
>>> NaN is a term of art referring specifically to the IEEE
>>> floating point standard. I've never seen "NaN" used in any
>>> other context (albeit some use it to refer to their grandmother :-).
>>
>> The C standard uses (and also defines) the word NaN as a generic
>> term applicable to floating-point representations in general. In
>> section 5.2.4.2.2 paragraph 3, the C standard says this
>>
>> A /NaN/ is an encoding signifying Not-a-Number.
>>
>> with the slant characters meaning italics, which indicates a
>> definition. The same paragraph gives generic definitions for
>> the more specialized terms "quiet NaN" and "signaling NaN".
>>
>> There is a footnote that mentions the IEEE floating-point
>> standard, but makes clear that terms for the various kinds of NaN
>> can refer to values in other floating-point systems that have
>> similar behavior.
>
> Agreed, the C standard is careful not to assume that floating-point
> systems other than IEEE do or do not have NaNs.
>
> In the real world, as far as I can tell, IEEE happens to be the
> only floating-point system that has NaNs.

That question is best left to a different newsgroup. In any
case it makes no difference to my statement, which is only
about how the term NaN is used.

> IEEE introduced NaNs
> in 1985, and the introduction of the IEEE standard inhibited the
> creation of other floating-point formats. (That's not *quite*
> true; apparently at least some implementations of "posits" provide
> NaNs. But I don't think any C implementation uses posits as its
> floating-point representation, and it might not be possible for a
> conforming implementation to do so.)

A surprising statement. What is it about posits that make
them impossible for a conforming C implementation? TTBOMK
the C standard allows nearly unlimited latitude for how
floating-point numbers and operations work in C. For the
record I know very little about posits.

> "IEEE" is of course a common shorthand for "IEEE 754".

The C standard uses the designation IEC 60559:1989 (in C11;
I haven't checked other versions of the standard).

Re: bart again (UCX64)

<uegcfh$3b9rp$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=45598&group=comp.lang.c#45598

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Wed, 20 Sep 2023 20:14:56 -0700
Organization: A noiseless patient Spider
Lines: 58
Message-ID: <uegcfh$3b9rp$1@dont-email.me>
References: <1262755563@f172.n1.z21.fsxnet>
<678354ed-d89c-4d45-adfd-1ded3d22eecan@googlegroups.com>
<87ttrzo1zm.fsf@bsb.me.uk>
<5e098055-c3bd-4f9c-984c-b4fdaf610adbn@googlegroups.com>
<DD0MM.39423$jJK6.35686@fx14.iad>
<647ac7a4-fb14-4072-b65f-5b20290a4b7bn@googlegroups.com>
<KN1MM.6185$Q73f.3452@fx48.iad>
<1ad9d75b-48bb-4b3a-93f0-92900479280en@googlegroups.com>
<uds4rb$23he0$1@dont-email.me>
<e837db60-7ae9-4aa6-b539-424b97579e4dn@googlegroups.com>
<udsach$24go6$1@dont-email.me> <60jMM.5116$quJ8.2754@fx18.iad>
<861qevmfym.fsf@linuxsc.com> <87edivkyfu.fsf@nosuchdomain.example.com>
<86zg1gjlf5.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 21 Sep 2023 03:14:58 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6b6da6c06c8d4fdd39d62ecdcb8836b9";
logging-data="3516281"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ysNiAcaxLi09JyUgM35YaNV4LWY/qWMw="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:H+4lGV0bFhs88YSid6Z8uz3UXPQ=
Content-Language: en-US
In-Reply-To: <86zg1gjlf5.fsf@linuxsc.com>
 by: Chris M. Thomasson - Thu, 21 Sep 2023 03:14 UTC

On 9/20/2023 7:43 PM, Tim Rentsch wrote:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>
>> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>>
>>> scott@slp53.sl.home (Scott Lurndal) writes:
>>>
>>>> NaN is a term of art referring specifically to the IEEE
>>>> floating point standard. I've never seen "NaN" used in any
>>>> other context (albeit some use it to refer to their grandmother :-).
>>>
>>> The C standard uses (and also defines) the word NaN as a generic
>>> term applicable to floating-point representations in general. In
>>> section 5.2.4.2.2 paragraph 3, the C standard says this
>>>
>>> A /NaN/ is an encoding signifying Not-a-Number.
>>>
>>> with the slant characters meaning italics, which indicates a
>>> definition. The same paragraph gives generic definitions for
>>> the more specialized terms "quiet NaN" and "signaling NaN".
>>>
>>> There is a footnote that mentions the IEEE floating-point
>>> standard, but makes clear that terms for the various kinds of NaN
>>> can refer to values in other floating-point systems that have
>>> similar behavior.
>>
>> Agreed, the C standard is careful not to assume that floating-point
>> systems other than IEEE do or do not have NaNs.
>>
>> In the real world, as far as I can tell, IEEE happens to be the
>> only floating-point system that has NaNs.
>
> That question is best left to a different newsgroup. In any
> case it makes no difference to my statement, which is only
> about how the term NaN is used.
>
>> IEEE introduced NaNs
>> in 1985, and the introduction of the IEEE standard inhibited the
>> creation of other floating-point formats. (That's not *quite*
>> true; apparently at least some implementations of "posits" provide
>> NaNs. But I don't think any C implementation uses posits as its
>> floating-point representation, and it might not be possible for a
>> conforming implementation to do so.)
>
> A surprising statement. What is it about posits that make
> them impossible for a conforming C implementation? TTBOMK
> the C standard allows nearly unlimited latitude for how
> floating-point numbers and operations work in C. For the
> record I know very little about posits.
>
>> "IEEE" is of course a common shorthand for "IEEE 754".
>
> The C standard uses the designation IEC 60559:1989 (in C11;
> I haven't checked other versions of the standard).

I wanted to implement posits one time, but never seemed to find it. They
are very interesting to me wrt perhaps using them in fractals. Use two
posits wrt complex numbers... :^)

Re: bart again (UCX64)

<87il84158n.fsf@nosuchdomain.example.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=45599&group=comp.lang.c#45599

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Wed, 20 Sep 2023 22:10:16 -0700
Organization: None to speak of
Lines: 64
Message-ID: <87il84158n.fsf@nosuchdomain.example.com>
References: <1262755563@f172.n1.z21.fsxnet>
<678354ed-d89c-4d45-adfd-1ded3d22eecan@googlegroups.com>
<87ttrzo1zm.fsf@bsb.me.uk>
<5e098055-c3bd-4f9c-984c-b4fdaf610adbn@googlegroups.com>
<DD0MM.39423$jJK6.35686@fx14.iad>
<647ac7a4-fb14-4072-b65f-5b20290a4b7bn@googlegroups.com>
<KN1MM.6185$Q73f.3452@fx48.iad>
<1ad9d75b-48bb-4b3a-93f0-92900479280en@googlegroups.com>
<uds4rb$23he0$1@dont-email.me>
<e837db60-7ae9-4aa6-b539-424b97579e4dn@googlegroups.com>
<udsach$24go6$1@dont-email.me> <60jMM.5116$quJ8.2754@fx18.iad>
<861qevmfym.fsf@linuxsc.com> <87edivkyfu.fsf@nosuchdomain.example.com>
<86zg1gjlf5.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="8cef8b95c5a155857121904884a8f0f8";
logging-data="3544828"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/a5IrTwlkEeX1OaOn7ZNCq"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:Z2hZaiErS2lV3FCvp0GjX5iIwsQ=
sha1:DYudSSAfOXtuz1jO74MI219IpX8=
 by: Keith Thompson - Thu, 21 Sep 2023 05:10 UTC

Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>
>> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>>
>>> scott@slp53.sl.home (Scott Lurndal) writes:
>>>
>>>> NaN is a term of art referring specifically to the IEEE
>>>> floating point standard. I've never seen "NaN" used in any
>>>> other context (albeit some use it to refer to their grandmother :-).
>>>
>>> The C standard uses (and also defines) the word NaN as a generic
>>> term applicable to floating-point representations in general. In
>>> section 5.2.4.2.2 paragraph 3, the C standard says this
>>>
>>> A /NaN/ is an encoding signifying Not-a-Number.
>>>
>>> with the slant characters meaning italics, which indicates a
>>> definition. The same paragraph gives generic definitions for
>>> the more specialized terms "quiet NaN" and "signaling NaN".
>>>
>>> There is a footnote that mentions the IEEE floating-point
>>> standard, but makes clear that terms for the various kinds of NaN
>>> can refer to values in other floating-point systems that have
>>> similar behavior.
>>
>> Agreed, the C standard is careful not to assume that floating-point
>> systems other than IEEE do or do not have NaNs.
>>
>> In the real world, as far as I can tell, IEEE happens to be the
>> only floating-point system that has NaNs.
>
> That question is best left to a different newsgroup. In any
> case it makes no difference to my statement, which is only
> about how the term NaN is used.

You'll note that I started by saying I agreed with you.

I'd say that since the C standard has a lot to say about floating-point,
including NaNs and optional support for IEEE (IEC 60559) floating-point,
it's a relevant issue.

>> IEEE introduced NaNs
>> in 1985, and the introduction of the IEEE standard inhibited the
>> creation of other floating-point formats. (That's not *quite*
>> true; apparently at least some implementations of "posits" provide
>> NaNs. But I don't think any C implementation uses posits as its
>> floating-point representation, and it might not be possible for a
>> conforming implementation to do so.)
>
> A surprising statement. What is it about posits that make
> them impossible for a conforming C implementation? TTBOMK
> the C standard allows nearly unlimited latitude for how
> floating-point numbers and operations work in C. For the
> record I know very little about posits.

Posits, as I understand them, have a dynamically varying number of
exponent bits. That seems inconsistent with the floating point model
described in N1570 5.2.4.2.2 (<float.h>).

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: bart again (UCX64)

<86a5t2dxu2.fsf@linuxsc.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=45877&group=comp.lang.c#45877

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17687@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Sun, 01 Oct 2023 11:03:33 -0700
Organization: A noiseless patient Spider
Lines: 83
Message-ID: <86a5t2dxu2.fsf@linuxsc.com>
References: <1262755563@f172.n1.z21.fsxnet> <678354ed-d89c-4d45-adfd-1ded3d22eecan@googlegroups.com> <87ttrzo1zm.fsf@bsb.me.uk> <5e098055-c3bd-4f9c-984c-b4fdaf610adbn@googlegroups.com> <DD0MM.39423$jJK6.35686@fx14.iad> <647ac7a4-fb14-4072-b65f-5b20290a4b7bn@googlegroups.com> <KN1MM.6185$Q73f.3452@fx48.iad> <1ad9d75b-48bb-4b3a-93f0-92900479280en@googlegroups.com> <uds4rb$23he0$1@dont-email.me> <e837db60-7ae9-4aa6-b539-424b97579e4dn@googlegroups.com> <udsach$24go6$1@dont-email.me> <60jMM.5116$quJ8.2754@fx18.iad> <861qevmfym.fsf@linuxsc.com> <87edivkyfu.fsf@nosuchdomain.example.com> <86zg1gjlf5.fsf@linuxsc.com> <87il84158n.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="5df80bfa77615176987b6091c1d3373e";
logging-data="2562712"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18R0miaQrjkLRypyI8BWLS71P8qh6vRJi8="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:/PtY6vDKAvU43GLH6k+2e+AB6fU=
sha1:7biggMmY1+J8zz510vJxbfgRGGA=
 by: Tim Rentsch - Sun, 1 Oct 2023 18:03 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>
>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>
>>> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>>>
>>>> scott@slp53.sl.home (Scott Lurndal) writes:
>>>>
>>>>> NaN is a term of art referring specifically to the IEEE
>>>>> floating point standard. I've never seen "NaN" used in any
>>>>> other context (albeit some use it to refer to their grandmother :-).
>>>>
>>>> The C standard uses (and also defines) the word NaN as a generic
>>>> term applicable to floating-point representations in general. In
>>>> section 5.2.4.2.2 paragraph 3, the C standard says this
>>>>
>>>> A /NaN/ is an encoding signifying Not-a-Number.
>>>>
>>>> with the slant characters meaning italics, which indicates a
>>>> definition. The same paragraph gives generic definitions for
>>>> the more specialized terms "quiet NaN" and "signaling NaN".
>>>>
>>>> There is a footnote that mentions the IEEE floating-point
>>>> standard, but makes clear that terms for the various kinds of NaN
>>>> can refer to values in other floating-point systems that have
>>>> similar behavior.
>>>
>>> Agreed, the C standard is careful not to assume that floating-point
>>> systems other than IEEE do or do not have NaNs.
>>>
>>> In the real world, as far as I can tell, IEEE happens to be the
>>> only floating-point system that has NaNs.
>>
>> That question is best left to a different newsgroup. In any
>> case it makes no difference to my statement, which is only
>> about how the term NaN is used.
>
> You'll note that I started by saying I agreed with you.
>
> I'd say that since the C standard has a lot to say about floating-point,
> including NaNs and optional support for IEEE (IEC 60559) floating-point,
> it's a relevant issue.

I don't know what it is you think your comments are relevant to.
I don't see how they are relevant to what I said in my earlier
posting.

>>> IEEE introduced NaNs
>>> in 1985, and the introduction of the IEEE standard inhibited the
>>> creation of other floating-point formats. (That's not *quite*
>>> true; apparently at least some implementations of "posits" provide
>>> NaNs. But I don't think any C implementation uses posits as its
>>> floating-point representation, and it might not be possible for a
>>> conforming implementation to do so.)
>>
>> A surprising statement. What is it about posits that make
>> them impossible for a conforming C implementation? TTBOMK
>> the C standard allows nearly unlimited latitude for how
>> floating-point numbers and operations work in C. For the
>> record I know very little about posits.
>
> Posits, as I understand them, have a dynamically varying number of
> exponent bits. That seems inconsistent with the floating point model
> described in N1570 5.2.4.2.2 (<float.h>).

The model you mention is used to define "the characteristics of
floating types", where "characteristics" is understood to be the
preprocessor-symbol numerical limits defined in that section. There
is nothing in the C standard that requires the representation of
floating types to match the description outlined in model, or to "be
consistent" with it. There is a footnote in the first paragraph of
5.2.4.2.2; it says

The floating-point model is intended to clarify the description
of each floating-point characteristic and does not require the
floating-point arithmetic of the implementation to be identical.

So I still don't know why you think a conforming C implementation
couldn't use posits, or some other similar scheme where the
number of significand bits varies depending on the exponent, as
its representation for floating types.

Pages:12345
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor