procmail
[Top] [All Lists]

c = b / a

2004-06-30 16:24:24
I need a general division recipe. 
I now have this:

# Calculate c = a / b.
# Both a and b are positive numbers.
# The result c is an integer value, rounded down towards 0.

--- div.rc ---
  VERBOSE   = yes
  DEFAULT   = /dev/null

  dot = "."

  a = 20
  b = 9

  c = 0
  :0
  *          1^0
  *$        $a^0
  *$       -$b^0
  {
    :0
    *$ dot ?? $a^1 > $b
    { } c = $=
  }
--- div.rc ---

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

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