home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
forth
/
compiler
/
fpc
/
source
/
p3_30dc.seq
< prev
next >
Wrap
Text File
|
1990-04-06
|
661b
|
24 lines
\ Problem 3.30 by Dickson Cheng 04/06/90 15:53:12.04
: XNEW ( n xold -- n xnew )
2DUP / + 2/ ;
: SQRT ( n -- root )
DUP 0< IF ABORT" Illegal argument" THEN
DUP 1 >
IF DUP 2/
10 0 DO XNEW LOOP NIP
THEN ;
: TRI_AREA ( a b c -- area )
2 PICK 2 PICK 2 PICK ( a b c -- a b c a b c )
+ + 2/ >R ( ??? -- a b c ) \ s->r
R@ 3 ROLL - -ROT ( ??? -- s-a b c )
R@ ROT - -ROT ( ??? -- s-b s-a c )
R@ SWAP - ( ??? -- s-b s-a s-c )
R> * * * SQRT ; ( sqrt[ s*[s-b]*[s-a]*[s-c] ] )