Liste des Groupes | Revenir à cl c |
On 6/12/2024 5:30 PM, Barry Schwarz wrote:On Wed, 12 Jun 2024 16:47:23 -0400, DFS <nospam@dfs.com> wrote:
Wrote a C program to mimic the stats shown on:
>
https://www.calculatorsoup.com/calculators/statistics/descriptivestatistics.php
>
My code compiles and works fine - every stat matches - except for one
anomaly: when using a dataset of consecutive numbers 1 to N, all values40 are flagged as outliers. Up to 40, no problem. Random numbersdataset of any size: no problem.
>
And values 41+ definitely don't meet the conditions for outliers (using
the IQR * 1.5 rule).
>
Very strange.
>
Edit: I just noticed I didn't initialize a char:
before: char outliers[100];
after : char outliers[100] = "";
>
And the problem went away. Reset it to before and problem came back.
>
Makes no sense. What could cause the program to go FUBAR at data point
41+ only when the dataset is consecutive numbers?
>Also, why doesn't gcc just do you a solid and initialize to "" for you?Makes perfect sense. The first rule of undefined behavior is
"Whatever happens is exactly correct." You are not entitled to any
expectations and none of the behavior (or perhaps all of the behavior)
can be called unexpected.
I HATE bogus answers like this.
>
Aren't you embarrassed to say things like that?
Les messages affichés proviennent d'usenet.