Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #35007 > unrolled thread

Is old code out of phase?

Started byChing-Tang Tseng <ilikeforth@gmail.com>
First post2014-12-17 22:51 -0800
Last post2014-12-21 17:44 -0800
Articles 20 on this page of 38 — 9 participants

Back to article view | Back to comp.lang.forth


Contents

  Is old code out of phase? Ching-Tang Tseng <ilikeforth@gmail.com> - 2014-12-17 22:51 -0800
    Re: Is old code out of phase? empty-buffers <empty.buffersYOU-DONT-WANT-THIS@gmail.NEITHER-THIS.com> - 2014-12-19 02:26 +0000
    Re: Is old code out of phase? Ching-Tang Tseng <ilikeforth@gmail.com> - 2014-12-18 20:31 -0800
      Re: Is old code out of phase? Julian Fondren <julian.fondren@gmail.com> - 2014-12-19 06:25 -0800
      Re: Is old code out of phase? empty-buffers <empty.buffersYOU-DONT-WANT-THIS@gmail.NEITHER-THIS.com> - 2014-12-19 16:04 +0000
    Re: Is old code out of phase? hughaguilar96@gmail.com - 2014-12-19 00:08 -0800
      Re: Is old code out of phase? "WJ" <w_a_x_man@yahoo.com> - 2014-12-19 08:34 +0000
      Re: Is old code out of phase? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-12-19 08:37 -0600
        Re: Is old code out of phase? "WJ" <w_a_x_man@yahoo.com> - 2014-12-19 23:14 +0000
          Re: Is old code out of phase? mix <mix@test.net> - 2014-12-19 23:22 +0000
            Re: Is old code out of phase? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-12-20 03:43 -0600
      Re: Is old code out of phase? mix <mix@test.net> - 2014-12-19 21:13 +0000
        Re: Is old code out of phase? mix <mix@test.net> - 2014-12-20 09:29 +0000
          Re: Is old code out of phase? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-12-20 05:16 -0600
            Re: Is old code out of phase? mix <mix@test.net> - 2014-12-20 13:55 +0000
    Re: Is old code out of phase? Ching-Tang Tseng <ilikeforth@gmail.com> - 2014-12-19 04:29 -0800
    Re: Is old code out of phase? Ching-Tang Tseng <ilikeforth@gmail.com> - 2014-12-19 20:39 -0800
      Re: Is old code out of phase? hughaguilar96@gmail.com - 2014-12-20 22:02 -0800
        Re: Is old code out of phase? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-12-21 14:36 +0000
          Re: Is old code out of phase? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-12-21 14:39 +0000
    Re: Is old code out of phase? Ching-Tang Tseng <ilikeforth@gmail.com> - 2014-12-19 20:40 -0800
      Re: Is old code out of phase? mhx@iae.nl - 2014-12-19 23:28 -0800
        Re: Is old code out of phase? mhx@iae.nl - 2014-12-19 23:38 -0800
          Re: Is old code out of phase? mhx@iae.nl - 2014-12-20 00:24 -0800
      Re: Is old code out of phase? empty-buffers <empty.buffersYOU-DONT-WANT-THIS@gmail.NEITHER-THIS.com> - 2014-12-20 21:51 +0000
    Re: Is old code out of phase? Ching-Tang Tseng <ilikeforth@gmail.com> - 2014-12-19 20:42 -0800
    Re: Is old code out of phase? Ching-Tang Tseng <ilikeforth@gmail.com> - 2014-12-19 20:43 -0800
    Re: Is old code out of phase? Ching-Tang Tseng <ilikeforth@gmail.com> - 2014-12-20 01:57 -0800
      Re: Is old code out of phase? mhx@iae.nl - 2014-12-20 03:00 -0800
    Re: Is old code out of phase? Ching-Tang Tseng <ilikeforth@gmail.com> - 2014-12-20 02:09 -0800
    Re: Is old code out of phase? Ching-Tang Tseng <ilikeforth@gmail.com> - 2014-12-20 12:52 -0800
      Re: Is old code out of phase? mhx@iae.nl - 2014-12-20 14:20 -0800
    Re: Is old code out of phase? Ching-Tang Tseng <ilikeforth@gmail.com> - 2014-12-20 17:50 -0800
      Re: Is old code out of phase? empty-buffers <empty.buffersYOU-DONT-WANT-THIS@gmail.NEITHER-THIS.com> - 2014-12-21 02:15 +0000
    Re: Is old code out of phase? Ching-Tang Tseng <ilikeforth@gmail.com> - 2014-12-20 17:58 -0800
    Re: Is old code out of phase? Ching-Tang Tseng <ilikeforth@gmail.com> - 2014-12-21 02:34 -0800
    Re: Is old code out of phase? Ching-Tang Tseng <ilikeforth@gmail.com> - 2014-12-21 17:14 -0800
      Re: Is old code out of phase? hughaguilar96@gmail.com - 2014-12-21 17:44 -0800

Page 1 of 2  [1] 2  Next page →


#35007 — Is old code out of phase?

FromChing-Tang Tseng <ilikeforth@gmail.com>
Date2014-12-17 22:51 -0800
SubjectIs old code out of phase?
Message-ID<417351e4-2e28-4d5f-9ded-97955611f482@googlegroups.com>
Am I too old, posted codes is useless, meaningless, disturbed you too much? 
If yes, sorry very much, it is alright, I can back off, be quiet, standing aside, just seeing you young guy. After this posting, let's take a rest away from BASIC. 

How are you Hugh? Wish you are all right. You are good. See you some other day.

I have many times experiences to get some old code here. Some of them are even more than 20 years old (1994). I have done a one time searching, sorting out 9 useful square root FORTH programs. Where is another comp.lang.forth? It is hard to find.

This time, you can say that this code is old enough more than 30 years (1980). But he is in phase still. I still use it on Win32Forth under W7 OS. How about the code of 1968? The same situation, I have, and keep it going running right now, and can let it keep going running after another 30 years. FORTH made it, makes it, and will make it forever. This code is the proving. I hope I can see it again after 30 years. So, I am only just posting it here. Have interesting? Please look back to Charles H. Moore, "Programming a BASIC Compiler in FORTH", FORML 1981, p.513. 8 blocks program inside.

If you think that FORTH is really hard to use, and you are still need some help to solve some mathematics problems? How about you pay let me do? Do you have any valuable FORTRAN code would like to extend his life forever? You pay I do. No matter how big it is? You pay I do. The reference book of the following program was got from OP (Opportunity) shop in New Zealand. Cost me one dollar only.

\ ABC FORTH demo code: Inverse Matrix
\ Author: Ching-Tang Tseng, Hamilton, New Zealand
\ Date: 2009-06-14 (renewed for c.l.f. posting on 2014-12-19)
\ Contact: ilikeforth@gmail.com

\ Reference: F. R. Rukdeschel, "BASIC Scientific Subroutines Vol.1',
\ BYTE/McGRAW-HILL, 1980, p.95, Matrix inversion subroutine (MATINV)
\ Gauss-Jordan Elimination
\ Matrix A is input. Matrix C is output

20 VALUE D      \ unique setting in this program for maximum matrix Dimension

D D MATRIX U
D D MATRIX V
D D MATRIX W

D D MATRIX A
D D 2 * MATRIX B
D D MATRIX C

7 INTEGERS I J K N I+N J+N M
1 REALS B1

: InputData ( -- )
  [[ N = 5 ]]
  {{ A ( 1 1 ) = 1 }} {{ A ( 1 2 ) = 3 }} {{ A ( 1 3 ) = 2 }} {{ A ( 1 4 ) = 6 }} {{ A ( 1 5 ) = 4 }}
  {{ A ( 2 1 ) = 3 }} {{ A ( 2 2 ) = 5 }} {{ A ( 2 3 ) = 4 }} {{ A ( 2 4 ) = 2 }} {{ A ( 2 5 ) = 6 }}
  {{ A ( 3 1 ) = 3 }} {{ A ( 3 2 ) = 8 }} {{ A ( 3 3 ) = 6 }} {{ A ( 3 4 ) = 7 }} {{ A ( 3 5 ) = 5 }}
  {{ A ( 4 1 ) = 2 }} {{ A ( 4 2 ) = 5 }} {{ A ( 4 3 ) = 3 }} {{ A ( 4 4 ) = 4 }} {{ A ( 4 5 ) = 4 }}
  {{ A ( 5 1 ) = 7 }} {{ A ( 5 2 ) = 6 }} {{ A ( 5 3 ) = 8 }} {{ A ( 5 4 ) = 7 }} {{ A ( 5 5 ) = 6 }}
;

: MatrixInverse ( -- )
BASIC
10 FOR I = 1 TO N
20 FOR J = 1 TO N
30 LET J+N = J + N
40 LET { B ( I J+N ) = 0 }
50 LET { B ( I J ) = A ( I J ) }
60 NEXT J
70 LET I+N = I + N
80 LET { B ( I I+N ) = 1 }
90 NEXT I

\ Perform row oriented operations to convert the left hand side of B
\ to the identity matrix. The inverse of A will then be on the right.

100 FOR K = 1 TO N

110 IF K = N THEN 240
120 LET M = K

\ Find maximum element
130 FOR I = K + 1 TO N
140 IF { ABS ( B ( I K ) ) > ABS ( B ( M K ) ) } THEN 160
150 GOTO 170
160 LET M = I
170 NEXT I

180 IF M = K THEN 240
190 FOR J = K TO 2 * N
200 LET { B1 =  B ( K J ) }
210 LET { B ( K J ) = B ( M J ) }
220 LET { B ( M J ) = B1 }
230 NEXT J

\ Divide row K
240 FOR J = K + 1 TO 2 * N
250 LET { B ( K J ) = B ( K J ) / B ( K K ) }
260 NEXT J

270 IF K = 1 THEN 340

280 FOR I = 1 TO K - 1
290 FOR J = K + 1 TO 2 * N
300 LET { B ( I J ) = B ( I J ) - B ( I K ) * B ( K J ) }
310 NEXT J
320 NEXT I

\ Beware of this branch will be out of K loop.
330 IF K = N THEN 350  
340 GOTO 370
350 RUN 2drop
360 GOTO 430

370 FOR I = K + 1 TO N
380 FOR J = K + 1 TO 2 * N
390 LET { B ( I J ) = B ( I J ) - B ( I K ) * B ( K J ) }
400 NEXT J
410 NEXT I

420 NEXT K

\ Retrieve inverse from the right side of B
430 FOR I = 1 TO N
440 FOR J = 1 TO N
450 LET J+N = J + N
460 LET { B ( I J ) = B ( I J+N ) }
470 NEXT J
480 NEXT I

\ B is not a square matrix so transfer to square matrix C
490 FOR I = 1 TO N
500 FOR J = 1 TO N
510 LET { C ( I J ) = B ( I J ) }
520 NEXT J
530 NEXT I

490 END
;

: PrintMatrixW ( -- )
BASIC
10 RUN CR
20 FOR I = 1 TO N
30 FOR J = 1 TO N
40 LET { B1 = W ( I J ) } \ Based on W matrix
40 RUN B1 (F,)        \ Right justified printing
50 NEXT J
60 RUN CR
70 NEXT I
80 END
;

: TotalAmount ( -- )
  D 1+ DUP * 3 CELLS * ;
: MoveAtoW ( -- )
  address-of A 0 0 FMatrix
  address-of W 0 0 FMatrix
  TotalAmount CMOVE ;
: MoveCtoW ( -- )
  address-of C 0 0 FMatrix
  address-of W 0 0 FMatrix
  TotalAmount CMOVE ;
: MoveAtoU ( -- )
  address-of A 0 0 FMatrix
  address-of U 0 0 FMatrix
  TotalAmount CMOVE ;
: MoveCtoV ( -- )
  address-of C 0 0 FMatrix
  address-of V 0 0 FMatrix
  TotalAmount CMOVE ;

: Matrix* ( -- )
BASIC
\ Square Matrix Multiplication
\ W = U x V
10 FOR I = 1 TO N
20 FOR J = 1 TO N
30 LET { W ( I J ) = 0 }
40 FOR K = 1 TO N
50 LET { W ( I J ) = W ( I J ) + U ( I K ) * V ( K J ) }
60 NEXT K
70 NEXT J
80 NEXT I
90 END
;

: Checking ( -- )
BASIC
10 RUN MoveAtoU
20 RUN MoveCtoV
30 RUN Matrix*
40 RUN PrintMatrixW
50 END
;

: Once ( -- )
BASIC
10 PRINT " Matrix A = "
20 RUN MoveAtoW
30 RUN PrintMatrixW
40 RUN MatrixInverse
50 PRINT " Inverse of A = "
60 RUN MoveCtoW
70 RUN PrintMatrixW
80 PRINT " Matrix A times inverse of A = Identity Matrix "
90 RUN Checking
100 END
;

: test ( -- )
BASIC
10 RUN InputData
20 RUN Once
30 END
;

: hi ( -- )
BASIC
10 PRINT " Input dimension of Matrix to be inverted "
20 INPUTI N
30 FOR I = 1 TO N
40 PRINT " Input row " ; I
50 FOR J = 1 TO N
60 RUN CR
70 INPUTR B1
80 LET { A ( I J ) = B1 }
90 NEXT J
100 NEXT I
110 RUN Once
120 END
;

: ReadData ( -- )
BASIC
10 RUN S" MatInvData01.f" Get-File
20 RUN GetOneLineData
30 LET N = INT ( BRA ( 1 ) )
40 FOR I = 1 TO N
50 RUN GetOneLineData
60 FOR J = 1 TO N
70 LET { A ( I J ) = BRA ( J ) }
80 NEXT J
90 NEXT I
100 END
;

: main ( -- )
BASIC
10 RUN ReadData
20 RUN Once
30 END
;

page
.( Usage: ) cr
.( 1. test : for fixed input data ) cr
.( 2. hi   : for interactive input data ) cr
.( 3. main : for data input from file ) cr

\S
Usage: 
1. test : for fixed input data 
2. hi   : for interactive input data 
 ok
test 
Matrix A = 
1.00000 	3.00000 	2.00000 	6.00000 	4.00000
3.00000	5.00000	4.00000	2.00000	6.00000
3.00000	8.00000	6.00000	7.00000	5.00000  
2.00000	5.00000	3.00000	4.00000	4.00000  
7.00000	6.00000	8.00000	7.00000	6.00000  

Inverse of A = 
-.262431	-.367403	-.602210	1.17680	.259669  
-.279006	-.190608	-.071823	.745856	-.060773  
.135359	.389503	.668508	-1.48066	-.049724  
.157459	-.179558	-.038674	.093923	.044199  
.220994	.309392	-.071823	-.254144	-.060773  

Matrix A times inverse of A = Identity Matrix 
1.00000	-2.22045E-16	-1.11022E-16	-2.22045E-16	-2.77556E-17  
2.22045E-16	1.00000	-2.77556E-16	-2.22045E-16	5.55112E-17  
0.00000E0	-2.22045E-16	1.00000	4.44089E-16	5.55112E-17  
1.11022E-16 	-2.22045E-16	-3.33067E-16	1.00000	-5.55112E-17  
2.22045E-16	-8.88178E-16	-1.11022E-16	8.88178E-16	1.00000  
 ok
hi 
Input dimension of Matrix to be inverted? 3
Input row 1 
? 1
? 0
? 0
Input row 2 
? 0
? 2
? 0
Input row 3 
? 0
? 0
? 3
Matrix A = 
       1.00000       0.00000E0       0.00000E0  
     0.00000E0         2.00000       0.00000E0  
     0.00000E0       0.00000E0         3.00000  

Inverse of A = 
       1.00000       0.00000E0       0.00000E0  
     0.00000E0         .500000       0.00000E0  
     0.00000E0       0.00000E0         .333333  

Matrix A times inverse of A = Idendity Matrix 
       1.00000       0.00000E0       0.00000E0  
     0.00000E0         1.00000       0.00000E0  
     0.00000E0       0.00000E0         1.00000  
 ok
3 sigdigits !  ok
main 
Fileid is: 1212 
139 Bytes are read into the Fadr RAM buffer!
Matrix A = 
1.00		0.00E0	0.00E0	0.00E0	0.00E0	0.00E0	0.00E0	0.00E0  
1.00		1.00		0.00E0	0.00E0	0.00E0	0.00E0	0.00E0	0.00E0  
1.00		1.00		1.00		0.00E0	0.00E0	0.00E0	0.00E0	0.00E0  
1.00		1.00		1.00		1.00		0.00E0	0.00E0	0.00E0	0.00E0  
1.00		1.00		1.00		1.00		1.00		0.00E0	0.00E0	0.00E0  
1.00		1.00		1.00		1.00		1.00		1.00		0.00E0	0.00E0  
1.00		1.00		1.00		1.00		1.00		1.00		1.00		0.00E0  
1.00		1.00		1.00		1.00		1.00		1.00		1.00		1.00  

Inverse of A = 
1.00		0.00E0	0.00E0	0.00E0	0.00E0	0.00E0	0.00E0	0.00E0  
-1.00	1.00		0.00E0	0.00E0	0.00E0	0.00E0	0.00E0	0.00E0  
0.00E0	-1.00	1.00		0.00E0	0.00E0	0.00E0	0.00E0	0.00E0  
0.00E0	0.00E0	-1.00	1.00		0.00E0	0.00E0	0.00E0	0.00E0  
0.00E0	0.00E0	0.00E0	-1.00	1.00		0.00E0	0.00E0	0.00E0  
0.00E0	0.00E0	0.00E0	0.00E0	-1.00	1.00		0.00E0	0.00E0  
0.00E0	0.00E0	0.00E0	0.00E0	0.00E0	-1.00	1.00		0.00E0  
0.00E0	0.00E0	0.00E0	0.00E0	0.00E0	0.00E0	-1.00	1.00  

Matrix A times inverse of A = Identity Matrix 
1.00		0.00E0	0.00E0	0.00E0	0.00E0	0.00E0	0.00E0	0.00E0  
0.00E0	1.00		0.00E0	0.00E0	0.00E0	0.00E0	0.00E0	0.00E0  
0.00E0	0.00E0	1.00		0.00E0	0.00E0	0.00E0	0.00E0	0.00E0  
0.00E0	0.00E0	0.00E0	1.00		0.00E0	0.00E0	0.00E0	0.00E0  
0.00E0	0.00E0	0.00E0	0.00E0	1.00		0.00E0	0.00E0	0.00E0  
0.00E0	0.00E0	0.00E0	0.00E0	0.00E0	1.00		0.00E0	0.00E0  
0.00E0	0.00E0	0.00E0	0.00E0	0.00E0	0.00E0	1.00		0.00E0  
0.00E0	0.00E0	0.00E0	0.00E0	0.00E0 	0.00E0	0.00E0	1.00  
 ok

The format of data to be stored in MatInvData01.f is as following:

8
1 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0
1 1 1 0 0 0 0 0
1 1 1 1 0 0 0 0
1 1 1 1 1 0 0 0
1 1 1 1 1 1 0 0
1 1 1 1 1 1 1 0
1 1 1 1 1 1 1 1

[toc] | [next] | [standalone]


#35016

Fromempty-buffers <empty.buffersYOU-DONT-WANT-THIS@gmail.NEITHER-THIS.com>
Date2014-12-19 02:26 +0000
Message-ID<slrnm9737n.lsr.empty.buffersYOU-DONT-WANT-THIS@Ferrycy.localdomain>
In reply to#35007
In comp.lang.forth, Ching-Tang Tseng wrote:

> Am I too old, posted codes is useless, meaningless, disturbed you too much? 

What I see as strange: actually why you're insisting on Forth's use, when you
seem to obviously prefer BASIC?

Isn't it a simpler way to use BASIC directly?
-- 
May the Forth be with you!

[toc] | [prev] | [next] | [standalone]


#35018

FromChing-Tang Tseng <ilikeforth@gmail.com>
Date2014-12-18 20:31 -0800
Message-ID<e38fdada-bbb4-4fff-be5d-e321a9d02ca2@googlegroups.com>
In reply to#35007
Empty-Buffers,

Held on, did I ever say that I prefer BASIC? No, absolutely not. Am I seems use BASIC only? No, I am not using pure BASIC, I am using BASIC style coding method in FORTH for "mathematical calculation" only.

Have you ever seen a BASIC can call infinitive amount of other BASIC programs and all FORTH words and mix all of them together?
Have you ever seen a BASIC can do a lot of strange things via FORTH in its program? Let me show you another short one here. This is just another simple strange function. I have lots. There are many, many strange things I found in it. 

Is it a pure BASIC only?

\ ABC FORTH demo code
\ Speaking.f
\ ABC FORTH speech output demo codes
\ Author : Ching-Tang Tseng, Hamilton NZ
\ Contact: ilikeforth@gmail.com
\ Date     : 2011-07-20
\ Original creator: Charles H. Moore
 
2 INTEGERS I J
 
: Moore ( -- )
BASIC
10 RUN S" This is a computer. " SPEAKING
20 FOR I = 1 TO 4
30 RUN S" Nothing can go. " SPEAKING
40 FOR J = 1 TO 3
50 RUN S" Wrong. " SPEAKING
60 NEXT J
70 NEXT I
80 END
;
 
\s
\ Voice along with text Output:
 ok
Moore 
This is a computer. 
Nothing can go. 
Wrong. 
Wrong. 
Wrong. 
Nothing can go. 
Wrong. 
Wrong. 
Wrong. 
Nothing can go. 
Wrong. 
Wrong. 
Wrong. 
Nothing can go. 
Wrong. 
Wrong. 
Wrong.  

About above demonstration code, let Win32Forth speaks full Chinese (more than 14,000 words) according to whatever Chinese text you had arranged in the program can be implemented out by me. I am able to let Win32Forth read a Chinese text file for you automatically. So long as give me any other kinds of speech sound source, no matter it is Russian or German can do as well. 

Thanks for visiting

Ching

[toc] | [prev] | [next] | [standalone]


#35026

FromJulian Fondren <julian.fondren@gmail.com>
Date2014-12-19 06:25 -0800
Message-ID<09052271-9af5-4452-ba48-e24ea0c3240a@googlegroups.com>
In reply to#35018
On Thursday, December 18, 2014 10:31:25 PM UTC-6, Ching-Tang Tseng wrote:
> Held on, did I ever say that I prefer BASIC?  No, absolutely
> not.  Am I seems use BASIC only? No, I am not using pure BASIC,
> I am using BASIC style coding method in FORTH for "mathematical
> calculation" only.

In this Speaking.f demo, you use BASIC just for control flow.  Why
not use Forth?

  : moore ( -- )
    s" This is a computer." speaking
    4 0 do s" Nothing can go." speaking
      3 0 do s" Wrong." speaking loop
    loop ;

In your first example in this thread, you repeatedly use BASIC
just to call several words in sequence:

  : Checking ( -- )
  BASIC
  10 RUN MoveAtoU
  20 RUN MoveCtoV
  30 RUN Matrix*
  40 RUN PrintMatrixW
  50 END
  ;

  : main ( -- )
  BASIC
  10 RUN ReadData
  20 RUN Once
  30 END
  ;

Why not use Forth?

  : Checking ( -- )  MoveAtoU  MoveCtoV  Matrix*  PrintMatrixW ;

  : main ( -- )
    ReadData
    Once ;

You also use BASIC just for simple prompted input of numbers,
file-based input, for output interleaved with just calling other
words.  So it doesn't seem like you're using BASIC just for
mathematical calculations.  If you were, I could argue that ftrans
and FSL are more worth your time:

http://galileo.phys.virginia.edu/~jvn/ftran202.htm
https://www.taygeta.com/fsl/scilib.html

But if you want is BASIC, I can see the appeal of ABC Forth.
Modern 'BASIC' bears very little resemblance to your code, and
BASICs that *would* run it probably have pretty terrible
implementations.  

I don't want BASIC, but I do think it's neat that BASIC works so
well as a embedded language in Forth.  Not many languages can do
that as neatly, without requiring you to put a bunch of
parentheses or quotes around the alien code.


-- Julian

[toc] | [prev] | [next] | [standalone]


#35028

Fromempty-buffers <empty.buffersYOU-DONT-WANT-THIS@gmail.NEITHER-THIS.com>
Date2014-12-19 16:04 +0000
Message-ID<slrnm98j5d.2km.empty.buffersYOU-DONT-WANT-THIS@Ferrycy.localdomain>
In reply to#35018
In comp.lang.forth, Ching-Tang Tseng wrote:
> Empty-Buffers,
>
> Held on, did I ever say that I prefer BASIC? No, absolutely not. Am I
> seems use BASIC only?  No, I am not using pure BASIC, I am using BASIC
> style coding method in FORTH for "mathematical calculation" only.
> [..]
>: Moore ( -- )
> BASIC
> 10 RUN S" This is a computer. " SPEAKING
> 20 FOR I = 1 TO 4
> 30 RUN S" Nothing can go. " SPEAKING
> 40 FOR J = 1 TO 3
> 50 RUN S" Wrong. " SPEAKING
> 60 NEXT J
> 70 NEXT I
> 80 END
> ;

"Absolutely not"? :]

I recall the saying: "Real Fortran programmers can write Fortran programs in
any language"... :)
-- 
May the Forth be with you!

[toc] | [prev] | [next] | [standalone]


#35020

Fromhughaguilar96@gmail.com
Date2014-12-19 00:08 -0800
Message-ID<68c643e5-990d-44a3-9aa5-a11dbacb6e85@googlegroups.com>
In reply to#35007
On Wednesday, December 17, 2014 11:51:04 PM UTC-7, Ching-Tang Tseng wrote:
> This time, you can say that this code is old enough more than 30 years (1980). But he is in phase still. I still use it on Win32Forth under W7 OS. How about the code of 1968? The same situation, I have, and keep it going running right now, and can let it keep going running after another 30 years. FORTH made it, makes it, and will make it forever. This code is the proving. I hope I can see it again after 30 years. So, I am only just posting it here. Have interesting? Please look back to Charles H. Moore, "Programming a BASIC Compiler in FORTH", FORML 1981, p.513. 8 blocks program inside.

I agree that old code can still be good code. Consider this thread, when I wanted a continued-fractions program:
https://groups.google.com/forum/#!topic/comp.lang.forth/BcWvGxFFuzA%5B1-25-false%5D

On Friday, November 20, 2009 12:07:12 AM UTC-7, Elizabeth D Rather wrote:
> Hugh Aguilar wrote:
> ...
> > The problem is the ANS-Forth standard. Really, how obvious was the
> > need for double-precision arithmetic? This could have been an
> > extension to the language similar to floating-point. Compiler-writers
> > working on small microprocessors could decline to implement it if they
> > didn't want to.
> > 
> > I am frustrated with the ANS-Forth standard because I believe that the
> > bad design of the standard is the #1 reason for the failure of Forth
> > to become an important language. Forth was doing pretty well in the
> > 1980s, but we needed a standard. What we got was Forth-83, and then
> > ANS-Forth-94, both of which were badly designed. With some more
> > thoughtful leadership we could have succeeded.
> 
> There are D+, D-, M*, M/, and M*/ (and the unsigned operators).  These 
> were adequate in a very wide variety of projects over a 30 year period, 
> many of which were extremely computation-intensive and running on slow 
> 16-bit processors.
> 
> Forth's design is pragmatic: it has functions that have been needed and 
> that have proven their usefulness *in Forth*, not necessarily those that 
> have been required in other languages.  Generally speaking, Forth has 
> the most flexible set of *integer* arithmetic operators of any language. 
>   In particular, M*/ was one of Chuck's most brilliant innovations.  I'm 
> sure if Chuck were trying to do your continued fractions that is what he 
> would rely on.  Yes, that sometimes requires thinking differently, like 
> many other things in Forth.
> 
> Cheers,
> Elizabeth

ANS-Forth lacks a D/ function, primarily because nobody at Forth Inc. was able to figure out how to implement it in assembly-language --- and Elizabeth Rather's goal in writing the ANS-Forth standard was to limit the entire Forth community to her own level of ignorance.

Elizabeth Rather says: "M*/ was one of Chuck's most brilliant innovations.  I'm 
> sure if Chuck were trying to do your continued fractions that is what he 
> would rely on.  Yes, that sometimes requires thinking differently, like 
> many other things in Forth."
Thinking differently from what? Reality? I needed a D/ function, and ANS-Forth wasn't providing it. That is reality. 

The result is that I ended up using Nathaniel Grosman's D/ function that he wrote back in the mid 1980s in high-level Forth --- this is what I provide in the novice package. It is rather ridiculous to write such a low-level function as D/ in high-level Forth, but that is what is required by ANS-Forth as D/ is not part of the standard. --- so we are still using Grosman's work-around to the failure of Forth to provide D/ as late as 2009 (2014 now).

> If you think that FORTH is really hard to use, and you are still need some help to solve some mathematics problems? How about you pay let me do? Do you have any valuable FORTRAN code would like to extend his life forever? You pay I do. No matter how big it is? You pay I do. 

I can't pay you anything, as I'm broke as a joke. ;-) At this time, my interest in mathematics primarily involves CAM (computer-aided-manufacturing; the generation of gcode for CNC machines), and the mathematics mostly involves trigonometry that I have a pretty good grip on myself already.

I would, however, be very interested in including ABC Forth in the novice package. I think that you are doing something worthwhile. I agree that basic BASIC is weak, but a BASIC that is written in Forth can be quite strong --- get the power of Forth combined with the ease of BASIC --- this could be quite useful for writing mathematical functions, especially for people with a strong mathematical background but a weak programming background (my brother, for example).

P.S. Do you play Wei-Chi? Most Chinese people do. I'm on KGS under the name Classic, if you are interested in playing against me. :-)

[toc] | [prev] | [next] | [standalone]


#35022

From"WJ" <w_a_x_man@yahoo.com>
Date2014-12-19 08:34 +0000
Message-ID<m70nue$2g0$1@dont-email.me>
In reply to#35020
hughaguilar96@gmail.com wrote:

> Consider this thread, when I wanted a continued-fractions program:

Gauche Scheme:

(continued-fraction 13579/2468)
  ===> (5 1 1 122 1 9)

(+ 5 (/ (+ 1 (/ (+ 1 (/ (+ 122 (/ (+ 1 (/ 9))))))))))
  ===> 13579/2468
 

[toc] | [prev] | [next] | [standalone]


#35027

FromAndrew Haley <andrew29@littlepinkcloud.invalid>
Date2014-12-19 08:37 -0600
Message-ID<2uidnc3Iv9irpQnJnZ2dnUU7-d2dnZ2d@supernews.com>
In reply to#35020
hughaguilar96@gmail.com wrote:

> The result is that I ended up using Nathaniel Grosman's D/ function
> that he wrote back in the mid 1980s in high-level Forth --- this is
> what I provide in the novice package. It is rather ridiculous to
> write such a low-level function as D/ in high-level Forth, but that
> is what is required by ANS-Forth as D/ is not part of the standard.
> --- so we are still using Grosman's work-around to the failure of
> Forth to provide D/ as late as 2009

Even in the strange world of Hugh, I can't understand what you are
complaining about.  Nat Grossman did an excellent job of writing D/ ,
I'm not aware of any faster algorithm, and it's a perfectly reasonable
thing to write in high-Level Forth, and it's an excellent example of a
library routine.

Andrew.

[toc] | [prev] | [next] | [standalone]


#35033

From"WJ" <w_a_x_man@yahoo.com>
Date2014-12-19 23:14 +0000
Message-ID<m72bg7$u55$1@dont-email.me>
In reply to#35027
Andrew Haley wrote:

> hughaguilar96@gmail.com wrote:
> 
> > The result is that I ended up using Nathaniel Grosman's D/ function
> > that he wrote back in the mid 1980s in high-level Forth --- this is
> > what I provide in the novice package. It is rather ridiculous to
> > write such a low-level function as D/ in high-level Forth, but that
> > is what is required by ANS-Forth as D/ is not part of the standard.
> > --- so we are still using Grosman's work-around to the failure of
> > Forth to provide D/ as late as 2009
> 
> Even in the strange world of Hugh, I can't understand what you are
> complaining about.  Nat Grossman did an excellent job of writing D/ ,
> I'm not aware of any faster algorithm, and it's a perfectly reasonable
> thing to write in high-Level Forth, and it's an excellent example of a
> library routine.
>

A simple arithmetic operator should not be written in a high-level
language.
It needs to be as fast as possible.
That is obvious to anyone with any sense.

[toc] | [prev] | [next] | [standalone]


#35034

Frommix <mix@test.net>
Date2014-12-19 23:22 +0000
Message-ID<m72bvp$hh3$1@news.mixmin.net>
In reply to#35033
"WJ" <w_a_x_man@yahoo.com> wrote:
> Andrew Haley wrote:
> 
>> hughaguilar96@gmail.com wrote:
>> 
>>> The result is that I ended up using Nathaniel Grosman's D/ function
>>> that he wrote back in the mid 1980s in high-level Forth --- this is
>>> what I provide in the novice package. It is rather ridiculous to
>>> write such a low-level function as D/ in high-level Forth, but that
>>> is what is required by ANS-Forth as D/ is not part of the standard.
>>> --- so we are still using Grosman's work-around to the failure of
>>> Forth to provide D/ as late as 2009
>> 
>> Even in the strange world of Hugh, I can't understand what you are
>> complaining about.  Nat Grossman did an excellent job of writing D/ ,
>> I'm not aware of any faster algorithm, and it's a perfectly reasonable
>> thing to write in high-Level Forth, and it's an excellent example of a
>> library routine.
>> 
> 
> A simple arithmetic operator should not be written in a high-level
> language.
> It needs to be as fast as possible.
> That is obvious to anyone with any sense.

Actually, it depends. If code have to be as portable as possible it would
be good to minimize quantity of machine code words. Sometime portability is
of more importance than speed.

-- 
mix x

[toc] | [prev] | [next] | [standalone]


#35046

FromAndrew Haley <andrew29@littlepinkcloud.invalid>
Date2014-12-20 03:43 -0600
Message-ID<AMednTejdpoi2QjJnZ2dnUU7-a2dnZ2d@supernews.com>
In reply to#35034
mix <mix@test.net> wrote:
> "WJ" <w_a_x_man@yahoo.com> wrote:
>> Andrew Haley wrote:
>> 
>>> hughaguilar96@gmail.com wrote:
>>> 
>>>> The result is that I ended up using Nathaniel Grosman's D/ function
>>>> that he wrote back in the mid 1980s in high-level Forth --- this is
>>>> what I provide in the novice package. It is rather ridiculous to
>>>> write such a low-level function as D/ in high-level Forth, but that
>>>> is what is required by ANS-Forth as D/ is not part of the standard.
>>>> --- so we are still using Grosman's work-around to the failure of
>>>> Forth to provide D/ as late as 2009
>>> 
>>> Even in the strange world of Hugh, I can't understand what you are
>>> complaining about.  Nat Grossman did an excellent job of writing D/ ,
>>> I'm not aware of any faster algorithm, and it's a perfectly reasonable
>>> thing to write in high-Level Forth, and it's an excellent example of a
>>> library routine.
>> 
>> A simple arithmetic operator should not be written in a high-level
>> language.
>> It needs to be as fast as possible.
>> That is obvious to anyone with any sense.
> 
> Actually, it depends. If code have to be as portable as possible it would
> be good to minimize quantity of machine code words. Sometime portability is
> of more importance than speed.

In this particular case you have to do a bunch of multiplications and
divisions.  If you have a high-performance optimizing compiler, those
operations will dominate the run time.  In addidition to that, D/
simply isn't very useful, especially not on 32- and 64-bit machines.

Andrew.

[toc] | [prev] | [next] | [standalone]


#35032

Frommix <mix@test.net>
Date2014-12-19 21:13 +0000
Message-ID<m724ed$cu$1@news.mixmin.net>
In reply to#35020
<hughaguilar96@gmail.com> wrote:
> On Wednesday, December 17, 2014 11:51:04 PM UTC-7, Ching-Tang Tseng wrote:
>> This time, you can say that this code is old enough more than 30 years
>> (1980). But he is in phase still. I still use it on Win32Forth under W7
>> OS. How about the code of 1968? The same situation, I have, and keep it
>> going running right now, and can let it keep going running after another
>> 30 years. FORTH made it, makes it, and will make it forever. This code
>> is the proving. I hope I can see it again after 30 years. So, I am only
>> just posting it here. Have interesting? Please look back to Charles H.
>> Moore, "Programming a BASIC Compiler in FORTH", FORML 1981, p.513. 8
>> blocks program inside.
> 
> I agree that old code can still be good code. Consider this thread, when
> I wanted a continued-fractions program:
> https://groups.google.com/forum/#!topic/comp.lang.forth/BcWvGxFFuzA%5B1-25-false%5D
> 
> On Friday, November 20, 2009 12:07:12 AM UTC-7, Elizabeth D Rather wrote:
>> Hugh Aguilar wrote:
>> ...
>>> The problem is the ANS-Forth standard. Really, how obvious was the
>>> need for double-precision arithmetic? This could have been an
>>> extension to the language similar to floating-point. Compiler-writers
>>> working on small microprocessors could decline to implement it if they
>>> didn't want to.
>>> 
>>> I am frustrated with the ANS-Forth standard because I believe that the
>>> bad design of the standard is the #1 reason for the failure of Forth
>>> to become an important language. Forth was doing pretty well in the
>>> 1980s, but we needed a standard. What we got was Forth-83, and then
>>> ANS-Forth-94, both of which were badly designed. With some more
>>> thoughtful leadership we could have succeeded.
>> 
>> There are D+, D-, M*, M/, and M*/ (and the unsigned operators).  These 
>> were adequate in a very wide variety of projects over a 30 year period, 
>> many of which were extremely computation-intensive and running on slow 
>> 16-bit processors.
>> 
>> Forth's design is pragmatic: it has functions that have been needed and 
>> that have proven their usefulness *in Forth*, not necessarily those that 
>> have been required in other languages.  Generally speaking, Forth has 
>> the most flexible set of *integer* arithmetic operators of any language. 
>>   In particular, M*/ was one of Chuck's most brilliant innovations.  I'm 
>> sure if Chuck were trying to do your continued fractions that is what he 
>> would rely on.  Yes, that sometimes requires thinking differently, like 
>> many other things in Forth.
>> 
>> Cheers,
>> Elizabeth
> 
> ANS-Forth lacks a D/ function, primarily because nobody at Forth Inc. was
> able to figure out how to implement it in assembly-language --- and
> Elizabeth Rather's goal in writing the ANS-Forth standard was to limit
> the entire Forth community to her own level of ignorance.
> 
> Elizabeth Rather says: "M*/ was one of Chuck's most brilliant innovations.  I'm 
>> sure if Chuck were trying to do your continued fractions that is what he 
>> would rely on.  Yes, that sometimes requires thinking differently, like 
>> many other things in Forth."
> Thinking differently from what? Reality? I needed a D/ function, and
> ANS-Forth wasn't providing it. That is reality. 
> 
> The result is that I ended up using Nathaniel Grosman's D/ function that
> he wrote back in the mid 1980s in high-level Forth --- this is what I
> provide in the novice package. It is rather ridiculous to write such a
> low-level function as D/ in high-level Forth, but that is what is
> required by ANS-Forth as D/ is not part of the standard. --- so we are
> still using Grosman's work-around to the failure of Forth to provide D/
> as late as 2009 (2014 now).

Which processors are you talking about? If it's modern Intel or AMD
processors (x86_64), I can write machine code version of D/.

>> If you think that FORTH is really hard to use, and you are still need
>> some help to solve some mathematics problems? How about you pay let me
>> do? Do you have any valuable FORTRAN code would like to extend his life
>> forever? You pay I do. No matter how big it is? You pay I do. 
> 
> I can't pay you anything, as I'm broke as a joke. ;-) At this time, my
> interest in mathematics primarily involves CAM
> (computer-aided-manufacturing; the generation of gcode for CNC machines),
> and the mathematics mostly involves trigonometry that I have a pretty
> good grip on myself already.
> 
> I would, however, be very interested in including ABC Forth in the novice
> package. I think that you are doing something worthwhile. I agree that
> basic BASIC is weak, but a BASIC that is written in Forth can be quite
> strong --- get the power of Forth combined with the ease of BASIC ---
> this could be quite useful for writing mathematical functions, especially
> for people with a strong mathematical background but a weak programming
> background (my brother, for example).
> 
> P.S. Do you play Wei-Chi? Most Chinese people do. I'm on KGS under the
> name Classic, if you are interested in playing against me. :-)


-- 
mix x

[toc] | [prev] | [next] | [standalone]


#35044

Frommix <mix@test.net>
Date2014-12-20 09:29 +0000
Message-ID<m73fim$o4d$1@news.mixmin.net>
In reply to#35032
mix <mix@test.net> wrote:
> <hughaguilar96@gmail.com> wrote:
>> On Wednesday, December 17, 2014 11:51:04 PM UTC-7, Ching-Tang Tseng wrote:
>>> This time, you can say that this code is old enough more than 30 years
>>> (1980). But he is in phase still. I still use it on Win32Forth under W7
>>> OS. How about the code of 1968? The same situation, I have, and keep it
>>> going running right now, and can let it keep going running after another
>>> 30 years. FORTH made it, makes it, and will make it forever. This code
>>> is the proving. I hope I can see it again after 30 years. So, I am only
>>> just posting it here. Have interesting? Please look back to Charles H.
>>> Moore, "Programming a BASIC Compiler in FORTH", FORML 1981, p.513. 8
>>> blocks program inside.
>> 
>> I agree that old code can still be good code. Consider this thread, when
>> I wanted a continued-fractions program:
>> https://groups.google.com/forum/#!topic/comp.lang.forth/BcWvGxFFuzA%5B1-25-false%5D
>> 
>> On Friday, November 20, 2009 12:07:12 AM UTC-7, Elizabeth D Rather wrote:
>>> Hugh Aguilar wrote:
>>> ...
>>>> The problem is the ANS-Forth standard. Really, how obvious was the
>>>> need for double-precision arithmetic? This could have been an
>>>> extension to the language similar to floating-point. Compiler-writers
>>>> working on small microprocessors could decline to implement it if they
>>>> didn't want to.
>>>> 
>>>> I am frustrated with the ANS-Forth standard because I believe that the
>>>> bad design of the standard is the #1 reason for the failure of Forth
>>>> to become an important language. Forth was doing pretty well in the
>>>> 1980s, but we needed a standard. What we got was Forth-83, and then
>>>> ANS-Forth-94, both of which were badly designed. With some more
>>>> thoughtful leadership we could have succeeded.
>>> 
>>> There are D+, D-, M*, M/, and M*/ (and the unsigned operators).  These 
>>> were adequate in a very wide variety of projects over a 30 year period, 
>>> many of which were extremely computation-intensive and running on slow 
>>> 16-bit processors.
>>> 
>>> Forth's design is pragmatic: it has functions that have been needed and 
>>> that have proven their usefulness *in Forth*, not necessarily those that 
>>> have been required in other languages.  Generally speaking, Forth has 
>>> the most flexible set of *integer* arithmetic operators of any language. 
>>>   In particular, M*/ was one of Chuck's most brilliant innovations.  I'm 
>>> sure if Chuck were trying to do your continued fractions that is what he 
>>> would rely on.  Yes, that sometimes requires thinking differently, like 
>>> many other things in Forth.
>>> 
>>> Cheers,
>>> Elizabeth
>> 
>> ANS-Forth lacks a D/ function, primarily because nobody at Forth Inc. was
>> able to figure out how to implement it in assembly-language --- and
>> Elizabeth Rather's goal in writing the ANS-Forth standard was to limit
>> the entire Forth community to her own level of ignorance.
>> 
>> Elizabeth Rather says: "M*/ was one of Chuck's most brilliant innovations.  I'm 
>>> sure if Chuck were trying to do your continued fractions that is what he 
>>> would rely on.  Yes, that sometimes requires thinking differently, like 
>>> many other things in Forth."
>> Thinking differently from what? Reality? I needed a D/ function, and
>> ANS-Forth wasn't providing it. That is reality. 
>> 
>> The result is that I ended up using Nathaniel Grosman's D/ function that
>> he wrote back in the mid 1980s in high-level Forth --- this is what I
>> provide in the novice package. It is rather ridiculous to write such a
>> low-level function as D/ in high-level Forth, but that is what is
>> required by ANS-Forth as D/ is not part of the standard. --- so we are
>> still using Grosman's work-around to the failure of Forth to provide D/
>> as late as 2009 (2014 now).
> 
> Which processors are you talking about? If it's modern Intel or AMD
> processors (x86_64), I can write machine code version of D/.

I guess I should clarify: I'll write it free of charge. There are just not
that many processors I have access to. It would be x86_64 (which I have in
my station) and the ones that can be emulated on it. 

>>> If you think that FORTH is really hard to use, and you are still need
>>> some help to solve some mathematics problems? How about you pay let me
>>> do? Do you have any valuable FORTRAN code would like to extend his life
>>> forever? You pay I do. No matter how big it is? You pay I do. 
>> 
>> I can't pay you anything, as I'm broke as a joke. ;-) At this time, my
>> interest in mathematics primarily involves CAM
>> (computer-aided-manufacturing; the generation of gcode for CNC machines),
>> and the mathematics mostly involves trigonometry that I have a pretty
>> good grip on myself already.
>> 
>> I would, however, be very interested in including ABC Forth in the novice
>> package. I think that you are doing something worthwhile. I agree that
>> basic BASIC is weak, but a BASIC that is written in Forth can be quite
>> strong --- get the power of Forth combined with the ease of BASIC ---
>> this could be quite useful for writing mathematical functions, especially
>> for people with a strong mathematical background but a weak programming
>> background (my brother, for example).
>> 
>> P.S. Do you play Wei-Chi? Most Chinese people do. I'm on KGS under the
>> name Classic, if you are interested in playing against me. :-)
> 



-- 
mix x

[toc] | [prev] | [next] | [standalone]


#35050

FromAndrew Haley <andrew29@littlepinkcloud.invalid>
Date2014-12-20 05:16 -0600
Message-ID<xtadnckPkJgKxwjJnZ2dnUU7-fmdnZ2d@supernews.com>
In reply to#35044
mix <mix@test.net> wrote:
>> 
>> Which processors are you talking about? If it's modern Intel or AMD
>> processors (x86_64), I can write machine code version of D/.
> 
> I guess I should clarify: I'll write it free of charge. There are just not
> that many processors I have access to. It would be x86_64 (which I have in
> my station) and the ones that can be emulated on it. 

It's really not easy to do D/ well.  There are lots of poor
implementations out there, many of them using iterative binary
division, which gets very expensive if you have 64 bits.  Grossman's
algorithm is good, and the only way I can see to improve it is a more
efficient way to choose the scale factor.

Andrew.

[toc] | [prev] | [next] | [standalone]


#35051

Frommix <mix@test.net>
Date2014-12-20 13:55 +0000
Message-ID<m73v42$mkf$1@news.mixmin.net>
In reply to#35050
Andrew Haley <andrew29@littlepinkcloud.invalid> wrote:
> mix <mix@test.net> wrote:
>>> 
>>> Which processors are you talking about? If it's modern Intel or AMD
>>> processors (x86_64), I can write machine code version of D/.
>> 
>> I guess I should clarify: I'll write it free of charge. There are just not
>> that many processors I have access to. It would be x86_64 (which I have in
>> my station) and the ones that can be emulated on it. 
> 
> It's really not easy to do D/ well.  There are lots of poor
> implementations out there, many of them using iterative binary
> division, which gets very expensive if you have 64 bits.  Grossman's
> algorithm is good, and the only way I can see to improve it is a more
> efficient way to choose the scale factor.
> 
> Andrew.

Well, I'm not the only one who knows Assembler out there. If my
implementation would be bad, there should be people here pointing me to the
right way. Right?

-- 
mix x

[toc] | [prev] | [next] | [standalone]


#35024

FromChing-Tang Tseng <ilikeforth@gmail.com>
Date2014-12-19 04:29 -0800
Message-ID<ece35348-0af1-4076-8e4e-1a05ee06316e@googlegroups.com>
In reply to#35007
Hugh and WJ,

Thanks to both of you. FORTH can do whatever you know detailed enough. 

Tonight, my family have visitor, time is passing midnight now, I promise reply you tomorrow.

Here, we are FORTH user. We like to make FORTH step forward only. Anybody thinks that your code style is better than FORTH or you can write out your topic in a very nice expression. You should try to implement it out in FORTH by yourself, don't ask anybody do it for you. Otherwise, I reject to reply, have no comments on it. I am able to post out the output of 128 bits integer division by so called "Q/.." word. Implement in Win32Forth, precision digits after decimal point can up to thousands. 

There are double number and quadruple number system in my ABC FORTH. Hugh, I can help you something on these aspects, if needed. Pay me for what? It is just a little joke to you. see you tomorrow.

Ching

[toc] | [prev] | [next] | [standalone]


#35036

FromChing-Tang Tseng <ilikeforth@gmail.com>
Date2014-12-19 20:39 -0800
Message-ID<f6ad5228-f67b-4225-814a-e50bfb58ac12@googlegroups.com>
In reply to#35007
To Hugh,

Thanks for your supporting.

I am really not so clear understood what a D/ you are talking about. I will try to study it more from your posting. I have downloaded it already. At first glance in your programs, I feel most of them were written in Swift FORTH. I have an evaluation version only. But can not use " [ " or " ] " such kinds of important FORTH instructions in it. 

Most of the time when I use FORTH, I used to use F83 only, the same as you. But sometimes I am still use ANS-FORTH, if needed. There are really a lot of FORTH standard problem arguments in front of us. How about try to accept my suggestion? Don't argue it again. A good system can supply all words to the user. If user don't like, can just don't use it and use others. For example, experts said that GOTO is ugly and dangerous, could make the program to be a noodle code. I agree, but it is so many beautiful programs implement out by the able man during the past time. We students had it to help us to solve our engineering problem so much. GOTO is innocent. If a system designer is really hate it so much. How about designed it out for other users and the designer don't have to use it? ABC FORTH sincerely has considered this point of view.

Friendly say it again, you don't have to pay anything for my joking. I am happy to have you to share my code, if needed in the future. As for posting useful code in your personal website for novice, I am afraid of my poor English can not reach that level. It is not my fault. I am an old Chinese. For university entrance examination 40 years ago, full mark of English is 100, I got 38 only. My Chinese mark is more than double to 38. May I say it once more? My Chinese is better than my FORTH. My FORTH is better than my English. My English is better than nothing. But my career is bigger than me. Mechanical Engineering is my major. CAM or CNC topics can be the items when we say the same language. 
You can see out here. There are still so many people don't think that ABC FORTH is one good way in FORTH development. It doesn't a matter. I help the people who support me. Both of your brother and you are welcome to me. I think under such a situation. We don't have to consider posting ABC FORTH out so hurry. I prefer let you and your brother have the testing on it first. I am nothing and can keep going to do nothing for FORTH. Let the other peoples do. Today, I feel tired, I still have so many things have to do. Feedback all responses in English are really a hard work to me. I didn't reply you early. We have fun with my granddaughter for half day long. She is 3 years old. 

Sorry, I don't play Wei-Chi. So it is pity, I can not play it with you. Another good pronunciation mark method is Wei2-Chi2. Chinese could have 5 different tones for each one word. Suffix with 0 to 4 tone's mark can help our foreigner friends more easy to speak out corrected tone of the Chinese sentence.  

[toc] | [prev] | [next] | [standalone]


#35062

Fromhughaguilar96@gmail.com
Date2014-12-20 22:02 -0800
Message-ID<c29bb512-76cc-4e43-a009-30f0f6fde2a0@googlegroups.com>
In reply to#35036
On Friday, December 19, 2014 9:39:17 PM UTC-7, Ching-Tang Tseng wrote:
> I am really not so clear understood what a D/ you are talking about. I will try to study it more from your posting. I have downloaded it already. 

D/ is just a double-precision integer division. I have it in CF.4TH --- this was written by Nathaniel Grosman and provided in a "Forth Dimensions" article (Sept/Oct 1984, which was the year I graduated from high-school) --- math such as this is above my ability, although I can understand it after I have seen it done.

Low-level words such as this should be in the standard, so the compiler-writer can provide them written in assembly-language. I think Grosman's algorithm is best when there is hardware support for division (double-precision numerator and single-precision denominator), but the simple bit-by-bit algorithm would be best when there is no division instruction. Putting them in the standard also ensures that every implementation works the same, so code that uses D/ will work from compiler to compiler.

D/ could be in an extension to the standard, so it doesn't have to be provided if the compiler-writer doesn't want to (it isn't used very much, and it does take up memory, plus takes time to implement especially if the compiler-writer isn't very good at implementing arithmetic).

The "Starting Forth" book provided some rational approximations of common numbers, such as pi, for use by */ the scalar. Even at the age of 18, I wondered how these were calculated. What if I wanted a rational approximation of a number that wasn't in the short list provided by "Starting Forth"? I read Grosman's article and I had my answer --- although I had no understanding of how his math worked --- even today, my understanding of the math is weak. Presumably, Charles Moore knew how to write a continued-fraction program, and this is how he generated the handful of rational-approximations that he provided in "Starting Forth" --- but he left Forth Inc., and there was nobody at remaining at Forth Inc. that knew anything about math, so when the ANS-Forth standard came out in 1994 Elizabeth Rather left D/ out because she didn't know what it was needed for and she didn't know how to implement it.

I think that it is okay to borrow code from stronger programmers such as Grosman, without understanding it, so long as credit is given. I am not impressed by WJ however, who promotes languages such as Gauche Scheme etc., here on comp.lang.forth. He tells us that Gauche Scheme has a continued-fraction program, but he doesn't know how it works, so he is offering us nothing. A continued-fraction calculation has to be done in twice the precision of the generated numbers. Most dynamic-OOP languages (such as Scheme) have a very limited list of supported data types (typically 4, so the tag can be 2 bits wide). I notice that WJ's generated numbers are 16-bit, implying that the calculation was done in 32-bit --- but 16-bit is useless in a 32-bit system! --- he is totally failing to understand the purpose of the whole exercise. Similarly, he says that Scheme and Ruby have a SPLIT function, but I don't care, because I have already written my own SPLIT function --- also, mine is very powerful, and I doubt that the Scheme or Ruby versions compare to my code.

My code is better than most everything that other people write, so I have little or no interest in WJ telling me that some language has some feature --- I feel confident that I can do better on my own --- how can anybody be a programmer and not believe in himself?

> At first glance in your programs, I feel most of them were written in Swift FORTH. I have an evaluation version only. But can not use " [ " or " ] " such kinds of important FORTH instructions in it. 

My novice package is written in ANS-Forth, and should run under any ANS-Forth system. I have tested it under SwiftForth, Win32Forth and Gforth --- and I'm currently using VFX successfully, but haven't fully tested it yet. I have SwiftForth-specific assembly-language in the novice package, but this is only compiled if the SwiftForth? flag is set to TRUE at the front of NOVICE.4TH --- just set this to FALSE if you have any other ANS-Forth system.

I don't know what you mean about [ and ] not working in the SwiftForth evaluation system --- I have only tested the professional SwiftForth (version-2). If you are having problems with SwiftForth, just dump it and switch over to VFX --- I have the free VFX evaluation version, and have not found any unsolvable problems yet --- if I do find any problem, I will either fix them myself or ask Pelc to fix it (I did find one problem so far, but I fixed it myself, and he also fixed it later on). Forth Inc. never fixes problems in SwiftForth in a timely manner, and when they eventually do fix the problems they demand extra money for the bug fix --- so I don't recommend SwiftForth at all.

> Most of the time when I use FORTH, I used to use F83 only, the same as you. But sometimes I am still use ANS-FORTH, if needed. 

A lot of people use the term F83 to mean the Forth-83 standard, but this is not correct. F83 was a particular Forth compiler (from Laxen and Perry) that was available for free. I never used F83; I used UR/Forth from Laboratory Microsystems --- UR/Forth was also Forth-83 compliant --- but UR/Forth didn't share any code with F83 and UR/Forth was a commercial product

> There are really a lot of FORTH standard problem arguments in front of us. How about try to accept my suggestion? Don't argue it again. A good system can supply all words to the user. If user don't like, can just don't use it and use others. 

I'm confused. What was your suggestion? I didn't argue with you previously --- I don't know what suggestion you are referring to, so I can't argue against it or for it.

> For example, experts said that GOTO is ugly and dangerous, could make the program to be a noodle code. I agree, but it is so many beautiful programs implement out by the able man during the past time. We students had it to help us to solve our engineering problem so much. GOTO is innocent. If a system designer is really hate it so much. How about designed it out for other users and the designer don't have to use it? ABC FORTH sincerely has considered this point of view.

A bad programmer can make a mess out of BASIC by overusing GOTO --- but a bad programmer can make a mess out of any language --- I programmed in BASIC before I programmed in Forth, and I didn't make a mess out of it, although I think that my ability increased a lot when I switched from BASIC to Forth.

BASIC can be used successfully --- I think that a BASIC written in Forth, such as you have, could be quite useful. There are a lot of useful mathematical programs from the past that could more easily be ported into your BASIC than ported into Forth. Also, there are a lot of programmers who would have difficulty learning Forth, but can learn your BASIC easily --- they can write in BASIC, but let the stronger programmers write the low-level functions in Forth --- so your BASIC is a step into Forth for them.

I am supportive of anybody who writes Forth code that works. Your BASIC implementation is written in Forth, and it is useful to some people, so I would be proud to include it in my novice package --- it is very rare that anybody writes anything in Forth that is useful to anybody --- so you are far ahead of the majority on comp.lang.forth who have never written anything that is useful to anybody.

[toc] | [prev] | [next] | [standalone]


#35075

Fromalbert@spenarnc.xs4all.nl (Albert van der Horst)
Date2014-12-21 14:36 +0000
Message-ID<5496daea$0$6873$e4fe514c@dreader36.news.xs4all.nl>
In reply to#35062
In article <c29bb512-76cc-4e43-a009-30f0f6fde2a0@googlegroups.com>,
 <hughaguilar96@gmail.com> wrote:

> A continued-fraction calculation has to be done in
>twice the precision of the generated numbers.

This is about generated a c.f. representation from a pre-existing
representation, such as pi in a number of decimals. This is essentially
a rational like 314/100. Because a c.f. representation is worth its
weight in bits, and a single precision c.f. has 2 times the bits
of a single precision number, you got to start from double precision.

We know that c.f. are in fact more fundamental than real or rational
numbers, so this calculation goes backwards.

The correct way to go about this is to calculate the c.f.'s
from thin air, such as an oracle that tells whether a rational
is above or below the target.

For square roots this oracle could be ( for P Q  approximating sqrt(5) )
: oracle   M*   5 DM*  M* D< ;

The oracle must be in double precision, but that is neither here nor
there with respect to the c.f. calculation that is entirely executed
in single precision.

This by the way illustrates why Chuck Moore finds the mixed mode
operators more important. D/ gives a false sense of security.
If you use it to divide a 120 bits number by a 60 bits number you
loose 60 bits of precision, and the result is only worth 60 bits.
So you have fooled yourself with a 128 bit result.

Groetjes Albert
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

[toc] | [prev] | [next] | [standalone]


#35076

Fromalbert@spenarnc.xs4all.nl (Albert van der Horst)
Date2014-12-21 14:39 +0000
Message-ID<5496dbae$0$6873$e4fe514c@dreader36.news.xs4all.nl>
In reply to#35075
In article <5496daea$0$6873$e4fe514c@dreader36.news.xs4all.nl>,
Albert van der Horst <albert@spenarnc.xs4all.nl> wrote:
>In article <c29bb512-76cc-4e43-a009-30f0f6fde2a0@googlegroups.com>,
> <hughaguilar96@gmail.com> wrote:
>
>> A continued-fraction calculation has to be done in
>>twice the precision of the generated numbers.
>
>This is about generated a c.f. representation from a pre-existing
>representation, such as pi in a number of decimals. This is essentially
>a rational like 314/100. Because a c.f. representation is worth its
>weight in bits, and a single precision c.f. has 2 times the bits
>of a single precision number, you got to start from double precision.
>
>We know that c.f. are in fact more fundamental than real or rational
>numbers, so this calculation goes backwards.
>
>The correct way to go about this is to calculate the c.f.'s
>from thin air, such as an oracle that tells whether a rational
>is above or below the target.
>
>For square roots this oracle could be ( for P Q  approximating sqrt(5) )
>: oracle   M*   5 DM*  M* D< ;

Oops this must be of course `` DUP M* '' instead of just `` M* ''.

>
>The oracle must be in double precision, but that is neither here nor
>there with respect to the c.f. calculation that is entirely executed
>in single precision.
>
>This by the way illustrates why Chuck Moore finds the mixed mode
>operators more important. D/ gives a false sense of security.
>If you use it to divide a 120 bits number by a 60 bits number you
>loose 60 bits of precision, and the result is only worth 60 bits.
>So you have fooled yourself with a 128 bit result.
>
>Groetjes Albert
>--
>Albert van der Horst, UTRECHT,THE NETHERLANDS
>Economic growth -- being exponential -- ultimately falters.
>albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
>
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.forth


csiph-web