procmail
[Top] [All Lists]

Re: exactly once

2004-08-24 17:25:53
David Tamkin wrote:

Hope you're better soon.

Meanwhile, regarding your earlier caution about troubles some builds or
platforms have with fractional values of x, I tried my original code

  :0
  * 1^.-5 ! ? command
  * -.8^0
  action

on the other of the two platforms where I can run procmail, and it
worked there as well.

I think you meant -.5 rather than .-5 there.

Anyway, it may be worth motivating David's choice of a .8 cutoff.

                              n
       n    k-1     1 - (-1/2)      2              n
  1 * Sum .5    =  ------------- = --- ( 1 - (-1/2) )
      k=1              3/2          3

  Before x 2/3: 0, 3/2, 3/4, 9/8, 15/16, 33/32, ... 1
  After  x 2/3: 0, 1,   1/2, 3/4,  5/8,  11/16, ... 2/3

We can choose to work with the top line and multiply everything by
2/3 at the very end.

The sequence alternates, odd terms going down to 1 from above, and
even terms up to 1 from below.  As all the even terms are < 1, let's
focus on the odd terms.  Since they go down, we really only need to
look at the first couple.  They correspond to exit codes of 1 and 3,
evaluating to 3/2 and 9/8, or 1.5 and 1.125, respectively.  We can
pick any cutoff in between them, and exit code 1 will stand alone.

So David just happened to pick 1.2 x 2/3 = .8 .

FYA,
Mike


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>