| Deutsch English Français Italiano |
|
<666b26e7$0$973$882e4bbb@reader.netnews.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news-out.netnews.com!postmaster.netnews.com!us14.netnews.com!not-for-mail
X-Trace: DXC=oIZMeme0WRdIQi<RSX3BniHWonT5<]0TmQ;nb^V>PUff=AnO\FUBY[`nF54O@^\1?dESf2LZ4kKliLQ^D7JJN18aankHQ>:kCVbOT>gi^X=X_aCGm4YP8f00j
X-Complaints-To: support@blocknews.net
Date: Thu, 13 Jun 2024 13:05:43 -0400
MIME-Version: 1.0
User-Agent: Betterbird (Windows)
Subject: Re: "undefined behavior"?
Newsgroups: comp.lang.c
References: <666a095a$0$952$882e4bbb@reader.netnews.com>
<v4d4h5$1rc9e$1@dont-email.me> <666a2146$0$950$882e4bbb@reader.netnews.com>
<slrnv6l7o6.bn3.ike@iceland.freeshell.org>
<666b0c7d$0$983$882e4bbb@reader.netnews.com> <v4f4eq$2aan2$1@dont-email.me>
Content-Language: en-US
From: DFS <nospam@dfs.com>
In-Reply-To: <v4f4eq$2aan2$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 54
Message-ID: <666b26e7$0$973$882e4bbb@reader.netnews.com>
NNTP-Posting-Host: 127.0.0.1
X-Trace: 1718298343 reader.netnews.com 973 127.0.0.1:58499
Bytes: 2398
On 6/13/2024 11:49 AM, Lew Pitcher wrote:
> On Thu, 13 Jun 2024 11:13:04 -0400, DFS wrote:
>
>> On 6/13/2024 3:25 AM, Ike Naar wrote:
>>> On 2024-06-12, DFS <nospam@dfs.com> wrote:
>>>> //no outliers
>>>> if ( min > lo && max < hi) {
>>>
>>> The condition for 'no outliers' is not the complement of
>>> the condition for 'at least one outlier' below.
>>
>> You're saying some outliers will not be flagged?
>
> [1] How does the above statement evaluate when (min == low) and (max == hi)?
>>>> //at least one outlier
>>>> if ( min < lo || max > hi) {
>
> [2] How does the above statement evaluate when (min == low) and (max == hi)?
> [3] Given the answers to questions 1 and 2, are there any values that
> satisfy /both/ the "no outliers" and "at least one outlier" conditions?
> Are there any values that satisfy /neither/ conditions?
> [snip]
>
>
> HTH
It does help. The original code won't miss any outliers, but it also
won't notify you there were none in the exceedingly rare case that the
bounds of the dataset exactly match the bounds of the outlier rule.
No outliers test:
Orig : if (min > lo && max < hi)
Fixed: if (min >= lo && max <= hi)
At least one outlier test:
Orig: if (min < lo || max > hi) {
No fix necessary
Thanks Lew.