Deutsch English Français Italiano |
<slrnv6l7o6.bn3.ike@iceland.freeshell.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.in-chemnitz.de!news.swapon.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Ike Naar <ike@sdf.org> Newsgroups: comp.lang.c Subject: Re: "undefined behavior"? Date: Thu, 13 Jun 2024 07:25:58 -0000 (UTC) Organization: A noiseless patient Spider Lines: 26 Message-ID: <slrnv6l7o6.bn3.ike@iceland.freeshell.org> References: <666a095a$0$952$882e4bbb@reader.netnews.com> <v4d4h5$1rc9e$1@dont-email.me> <666a2146$0$950$882e4bbb@reader.netnews.com> Injection-Date: Thu, 13 Jun 2024 09:25:58 +0200 (CEST) Injection-Info: dont-email.me; posting-host="7763e2c3f242d6e7b0ae1b399c284a70"; logging-data="2264850"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18J3uW6L8bnXSFBmdzKxpv5" User-Agent: slrn/1.0.3 (Patched for libcanlock3) (NetBSD) Cancel-Lock: sha1:W7aZ/tR8577mXY9bpngFEIyWtH8= Bytes: 1710 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. > strcat(outliers,"none (using IQR * 1.5 rule)"); > } > > //at least one outlier > if ( min < lo || max > hi) { > for(i = 0; i < N; i++) { > double val = (double)nums[i]; > if(val < lo || val > hi) { > sprintf(temp,"%.0f ",val); > temp[strlen(temp)] = '\0'; This is unnecessary; sprintf terminates the generated string with a null character. > strcat(outliers,temp); > } > } > strcat(outliers," (using IQR * 1.5 rule)"); > }