Path: csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: SAFEcode Date: Thu, 16 Apr 2015 08:55:32 -0700 Organization: None to speak of Lines: 81 Message-ID: <873840rrt7.fsf@kst-u.example.com> References: <726b3d86-0074-4f28-9968-c75a36870a15@googlegroups.com> <2a853a94-7471-48e8-ad4f-2d3e16c6421d@googlegroups.com> <4964f920-9e9b-44d1-a8c5-125462c8192e@googlegroups.com> <1f68d75f-0f30-4084-9aa3-c439c7667306@googlegroups.com> <78d03d4e-8eb2-4265-b734-0a6aee1a8b20@googlegroups.com> <3cc4cf1e-0a4f-49d0-be24-a07294d2f488@googlegroups.com> <87sic1sa3s.fsf@kst-u.example.com> <1f1874ce-edfe-4923-8d66-9bff31b56f0d@googlegroups.com> <87h9shrxzq.fsf@kst-u.example.com> <79e51590-587b-4fc3-8d7d-8c942be64d1b@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="9be37d943435275679235b07c7947eef"; logging-data="6756"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18xDpf3pKFwrrdFQK/hQ2qb" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:BRXfULLnzq3N75ys2ei7hq/aWZA= sha1:90bzN1wM9gfQQNK6Ylp7U+NodpY= Xref: csiph.com comp.lang.c:60147 Malcolm McLean writes: > On Wednesday, April 15, 2015 at 8:29:57 PM UTC+1, Keith Thompson wrote: >> Malcolm McLean writes: >> You're saying that you can think of the function (which function?) in >> two entirely inconsistent ways. Using crude ASCII graphics (you may >> need to use a fixed-width font to view this), you first describe a >> function whose graph would look something like this (the + and | >> characters are meant to be vertically aligned): >> >> +------------- >> | >> ------------+ >> >> and then a function whose graph would look something like this: >> >> ----------\ /--------- >> \ / >> V >> >> You say these are two ways to think of the same function. I say >> they're different functions. >> > They're not really. The function is "too low", "too high" or "just > right". So you can think of it as looking for a step, or you can > think of it as looking for the low point of a valley with two > walls pointing you to the answer. It's what visualisation works > for you. Seriously, what the *hell* are you talking about? My crude ASCII art was intended to be straightforward graphs of two *different* functions as you described them. They are not different visualizations of the same function, and I honestly cannot figure out how you think they could be. The first one could be, for example: double func1(double x) { if (x < 0.0) return -1.0; else if (x == 0.0) return 0.0; else return 1.0; } and the second could be: double func2(double x) { if (x < -1.0) return 1.0; else if (x > -1.0 && x < 0.0) return -x; else if (x >= 0.0 && x < 1.0) return x; else return 1.0; } (with a "valley" of width 2.0). Do those look like the same function to you? [...] >> And what does this have to do either with C or with the point you >> were trying to make about the golden ratio? >> > The question is how to probe something you know next to nothing about. > For example, we've opened a stream, which we know will send us a > human-composed message in English text. We want to store it in a > memory buffer. [snip] > So what's our best strategy now? And you assert that a Fibonacci sequence is the best strategy, yes? For all I know, that might be true. But your hand-waving arguments about *why* it's true (because it's some kind of "compromise" between linear and exponential growth?) have not furthered your claim. (I found a Wikipedia article discussing something like this, suggesting a Fibonacci-like sequence as an optimal strategy for this kind of thing. I don't remember the title or URL.) -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"