procmail
[Top] [All Lists]

Re: multiply by -1

2005-07-07 07:59:43
David:
Ruud:

     :0
     * VAR ?? ^^-\/[0-9]+
     *$ $MATCH ^ 0
     { VAR = "$=" }
     :0E
     *$ -$VAR ^ 0
     { VAR = "$=" }

Those look like just extra load over Gary's suggestion.

Gary's can create '-0' and '-2.5' etc. 
I went after truncation and non-numericalities.

      :0
      * VAR ?? ^^-?0*\/(0^^|[1-9][0-9]*)
      *$ $VAR ^ 0
      { VAR = "-$=" }
      :0E
      *$ $MATCH ^ 0
      { VAR = "$=" }
      :0E
      { VAR = 'zero' }


-- 
Grtz, Ruud

____________________________________________________________
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>