🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: sci.math.num-analysis
1 messages
1 total messages Started by rctthdb Tue, 20 Nov 1990 11:12
Re: # to the n-th power
#574
Author: rctthdb
Date: Tue, 20 Nov 1990 11:12
16 lines
1001 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 -----*
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads