procmail
[Top] [All Lists]

Re: c = b / a

2004-06-30 16:42:08
The subject wants to divide a by b, the text wants to divide b by a.
I'll go by the latter.

Ruud wrote,

I need a general division recipe.
I now have this:

  *          1^0
  *$        $a^0
  *$       -$b^0

Why are you making sure that a >= b?

Does anyone have a better approach? Preferably one that
can cope with negative numbers too.

The only place you're not coping with negative numbers is where you subtract b, and I don't know why you're doing that in the first place. I've illustrated in the past how to subtract a number that might be negative:

* $ $b^-2 HOST ?? ^^.|.^^

The problem you'll run into is with $=. It will always report an integer, any fractional part being rounded in the direction toward +1.
So unless a is a multiple of b, you won't get an accurate answer anyway.


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