Ruud H.G. van Tol | 1 Jul 2004 01:08
Picon

c = b / a

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

Gmane