Re: Need someone very familiar with arrays




"Steve Gerrard" <mynamehere@xxxxxxxxxxx> wrote in message news:QqKdneSs8oco1KvanZ2dnUVZ_vWtnZ2d@xxxxxxxxxxxxxx

"rialto" <noname@xxxxxxxxxx> wrote in message news:ez4amv9IIHA.1316@xxxxxxxxxxxxxxxxxxxxxxx
"Robert Morley" <rmorley@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:utZE3e2IIHA.5468@xxxxxxxxxxxxxxxxxxxxxxx


You got a bug. If non-zero elements are moved, then you must assign a zero to where those elements were moved from or the interior start loop will not know when to stop. It would in effect move until it reached the last non zero item in the list and then write that value repeatedly whenever a zero was encountered.

start would continue to increment, yes, but it would not do any more writing, since you have
If start < finish Then
a(start) = a(finish)

so the incrementing is harmless.

Because the loop "does" know where to stop, you don't need the start < finish checks in the interior loops.

As Larry pointed out, you do to avoid running off the end. Once you put the test in, then start will never increment past finish, so there is never any concern for what lies higher up than finish. Ergo, no setting to 0 is needed.


Larry is like "a black hole". Even the most obscure details can't escape him. A sharp mind.



.



Relevant Pages

  • Re: Need someone very familiar with arrays
    ... If non-zero elements are moved, then you must assign a zero to ... where those elements were moved from or the interior start loop will not know ... It would in effect move until it reached the last non zero item ... checks in the interior loops. ...
    (microsoft.public.vb.general.discussion)
  • Re: Application.Min - how to ignore zero value?
    ... No it is saying take the minimum of all values in the rfange that are not ... zero. ... > increment down with each loop. ...
    (microsoft.public.excel.programming)
  • Re: Need someone very familiar with arrays
    ... But while you are at it, why not increment start while you decrement finish? ... eliminate one pass through the interior start loop each time a zero is ... through the main loop. ...
    (microsoft.public.vb.general.discussion)
  • Re: Design for a small tube/valve mixer
    ... Quite right, an equivalent noise resistance is an approximation, however careful placement of zeros in the open loop response will reduce 1/f noise so that the approximation is quite good. ... In tubes I have yet to see the equivalent of a dc coupled triple so there is usually at least one zero in the open loop which ensures the gain drops to zero at dc. ... It tends to extend frequency response anyway but also, where the feedback factor is altered to provide variable closed loop gain, it is all to easy to get a significant gain increase hump at or below 1Hz, thus undoing all the potential good work of the open loop zeros - one reason for my comment about 'careful placement of zeros in the open loop'. ... This zero unfortunately reduces feedback a low/very low frequencies and hence *increases* closed loop gain at low or very low frequencies. ...
    (rec.audio.tubes)
  • Re: [PATCH] Avoid buffer overflows in get_user_pages()
    ... In particular, "len" is a signed int, and it is only checked at the ... So, if it is passed in as zero, the loop ... I think that, if get_user_pageshas been asked to grab zero pages, ... Which is a bug, and you want to catch it. ...
    (Linux-Kernel)