🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: sci.math.num-analysis
Article #573

Re: # to the n-th power

#573
From: H. de Bruijn
Date: Fri, 23 Nov 1990 08:37
16 lines
1068 bytes
The function x**n (x and n integer) is also non-present in standard FIG-FORTH.
Here's a possible implementation (just for fun):

: ^ ( n x -> x**n )
  1 SWAP ROT
  BEGIN DUP 0 <> WHILE
  2 /MOD >R IF
  SWAP OVER * SWAP THEN
  DUP * R> REPEAT
  DROP DROP ;

-- 
* Han de Bruijn; applications engineer | "A little bit of Physics  *
* TUD Computing Centre; P.O. Box 354   | would be NO idleness in   *
* 2600 AJ  Delft; The Netherlands.     | Mathematics" (HdB).       *
* E-mail: rctthdb@dutrun.tudelft.nl ---| Fax: +31 15 78 37 87 -----*
Technical Details
Message-ID: <5315@dutrun.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!apple!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!hp4nl!dutrun!rctthdb

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!apple!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!hp4nl!dutrun!rctthdb
From: rctthdb@dutrun.UUCP (H. de Bruijn)
Newsgroups: sci.math.num-analysis,comp.lang.forth
Subject: Re: # to the n-th power
Message-ID: <5315@dutrun.UUCP>
Date: 23 Nov 90 08:37:24 GMT
Reply-To: rctthdb@dutrun.UUCP (H. de Bruijn)
Organization: Delft University of Technology, The Netherlands
Lines: 16