Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #12206 > unrolled thread
| Started by | quiet_lad <gavcomedy@gmail.com> |
|---|---|
| First post | 2012-05-15 23:27 -0700 |
| Last post | 2012-05-18 22:58 -0700 |
| Articles | 20 on this page of 158 — 33 participants |
Back to article view | Back to comp.lang.forth
I beleive that forth could supplant ruby and perl and python if it wanted to quiet_lad <gavcomedy@gmail.com> - 2012-05-15 23:27 -0700
Re: I beleive that forth could supplant ruby and perl and python if it wanted to marko <marko@marko.marko> - 2012-05-16 17:50 +1000
Re: I beleive that forth could supplant ruby and perl and python if it wanted to "Rod Pemberton" <do_not_have@notemailntt.cmm> - 2012-05-16 06:51 -0400
Re: I beleive that forth could supplant ruby and perl and python if it wanted to BruceMcF <agila61@netscape.net> - 2012-05-16 07:59 -0700
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Jason Damisch <jasondamisch@yahoo.com> - 2012-05-16 09:28 -0700
Re: I beleive that forth could supplant ruby and perl and python if it wanted to "Rod Pemberton" <do_not_have@notemailntt.cmm> - 2012-05-17 04:08 -0400
Re: I beleive that forth could supplant ruby and perl and python if it wanted to "Elizabeth D. Rather" <erather@forth.com> - 2012-05-16 22:22 -1000
Re: I beleive that forth could supplant ruby and perl and python if it wanted to "A. K." <akk@nospam.org> - 2012-05-17 11:43 +0200
Re: I beleive that forth could supplant ruby and perl and python if it wanted to "Rod Pemberton" <do_not_have@notemailntt.cmm> - 2012-05-17 10:22 -0400
Re: I beleive that forth could supplant ruby and perl and python if it wanted to "A. K." <akk@nospam.org> - 2012-05-17 17:03 +0200
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Bernd Paysan <bernd.paysan@gmx.de> - 2012-05-18 01:15 +0200
Re: I beleive that forth could supplant ruby and perl and python if it wanted to "Rod Pemberton" <do_not_have@notemailntt.cmm> - 2012-05-17 19:19 -0400
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-05-18 12:40 +0000
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Bernd Paysan <bernd.paysan@gmx.de> - 2012-05-18 00:17 +0200
Re: I beleive that forth could supplant ruby and perl and python if it wanted to vandys@vsta.org - 2012-05-17 16:02 +0000
Re: I beleive that forth could supplant ruby and perl and python if it wanted to "A. K." <akk@nospam.org> - 2012-05-17 18:08 +0200
Re: I beleive that forth could supplant ruby and perl and python if it wanted to vandys@vsta.org - 2012-05-17 16:58 +0000
Re: I beleive that forth could supplant ruby and perl and python if it to Nomen Nescio <nobody@dizum.com> - 2012-05-17 19:03 +0200
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-17 12:27 -0500
Re: I beleive that forth could supplant ruby and perl and python if it wanted to vandys@vsta.org - 2012-05-17 18:52 +0000
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-17 18:18 -0500
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-05-18 01:39 -0700
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-18 04:50 -0500
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-05-18 04:40 -0700
Re: I beleive that forth could supplant ruby and perl and python if it wanted to humptydumpty <ouatubi@gmail.com> - 2012-05-18 15:15 +0300
Re: I beleive that forth could supplant ruby and perl and python if it wanted to "Elizabeth D. Rather" <erather@forth.com> - 2012-05-18 08:02 -1000
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Paul Rubin <no.email@nospam.invalid> - 2012-05-17 12:40 -0700
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-17 18:32 -0500
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-18 01:45 -0500
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Paul Rubin <no.email@nospam.invalid> - 2012-05-19 11:28 -0700
Re: I beleive that forth could supplant ruby and perl and python if it wanted to "Peter Knaggs" <pjk@bcs.org.uk> - 2012-05-17 21:38 +0100
Re: I beleive that forth could supplant ruby and perl and python if it wanted to vandys@vsta.org - 2012-05-17 21:17 +0000
Re: I beleive that forth could supplant ruby and perl and python if it wanted to stephenXXX@mpeforth.com (Stephen Pelc) - 2012-05-18 09:41 +0000
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-18 04:55 -0500
Re: I beleive that forth could supplant ruby and perl and python if it wanted to stephenXXX@mpeforth.com (Stephen Pelc) - 2012-05-18 13:50 +0000
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Mark Wills <markrobertwills@yahoo.co.uk> - 2012-05-18 03:24 -0700
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-18 06:10 -0500
Re: I beleive that forth could supplant ruby and perl and python if it wanted to "Rod Pemberton" <do_not_have@notemailntt.cmm> - 2012-05-18 08:10 -0400
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Mark Wills <forthfreak@gmail.com> - 2012-05-18 05:57 -0700
Re: I beleive that forth could supplant ruby and perl and python if it wanted to "Elizabeth D. Rather" <erather@forth.com> - 2012-05-18 08:14 -1000
Re: I beleive that forth could supplant ruby and perl and python if it wanted to John Passaniti <john.passaniti@gmail.com> - 2012-05-18 10:01 -0700
VFX code quality (was: I beleive that forth could supplant ...) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-05-18 12:58 +0000
Re: VFX code quality Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-18 09:43 -0500
Re: VFX code quality anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-05-19 10:54 +0000
Re: VFX code quality Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-19 11:43 -0500
Re: VFX code quality anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-05-22 08:26 +0000
Re: VFX code quality Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-22 03:52 -0500
Re: VFX code quality Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-22 04:02 -0500
Re: VFX code quality anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-05-22 09:25 +0000
Re: VFX code quality Bernd Paysan <bernd.paysan@gmx.de> - 2012-05-30 23:39 +0200
Re: VFX code quality anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-05-31 15:07 +0000
Re: VFX code quality Bernd Paysan <bernd.paysan@gmx.de> - 2012-05-31 20:24 +0200
Re: VFX code quality (was: I beleive that forth could supplant ...) stephenXXX@mpeforth.com (Stephen Pelc) - 2012-05-18 15:25 +0000
Re: VFX code quality (was: I beleive that forth could supplant ...) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-05-19 11:31 +0000
Re: VFX code quality (was: I beleive that forth could supplant ...) Bernd Paysan <bernd.paysan@gmx.de> - 2012-05-20 17:41 +0200
Re: VFX code quality Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-20 12:49 -0500
Re: VFX code quality Paul Rubin <no.email@nospam.invalid> - 2012-05-20 11:43 -0700
Re: VFX code quality "Elizabeth D. Rather" <erather@forth.com> - 2012-05-20 14:01 -1000
Re: VFX code quality Paul Rubin <no.email@nospam.invalid> - 2012-05-20 19:10 -0700
Re: VFX code quality "Elizabeth D. Rather" <erather@forth.com> - 2012-05-20 17:05 -1000
Re: VFX code quality Paul Rubin <no.email@nospam.invalid> - 2012-05-20 20:38 -0700
Re: VFX code quality "Elizabeth D. Rather" <erather@forth.com> - 2012-05-20 21:37 -1000
Re: VFX code quality Paul Rubin <no.email@nospam.invalid> - 2012-05-21 01:27 -0700
Re: VFX code quality m.a.m.hendrix@tue.nl - 2012-05-21 01:52 -0700
Re: VFX code quality Ecki <ecki@intershop.de> - 2012-05-21 11:06 +0200
Re: VFX code quality mhx@iae.nl (Marcel Hendrix) - 2012-05-21 20:34 +0200
Re: VFX code quality Ecki <ecki@intershop.de> - 2012-05-22 08:54 +0200
Re: VFX code quality anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-05-21 14:36 +0000
Re: VFX code quality mhx@iae.nl (Marcel Hendrix) - 2012-05-21 20:33 +0200
Re: VFX code quality Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-21 04:29 -0500
Re: VFX code quality Paul Rubin <no.email@nospam.invalid> - 2012-05-21 08:39 -0700
Re: VFX code quality Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-21 15:22 -0500
Re: VFX code quality Paul Rubin <no.email@nospam.invalid> - 2012-05-22 12:47 -0700
Re: VFX code quality "Elizabeth D. Rather" <erather@forth.com> - 2012-05-22 11:25 -1000
Re: VFX code quality Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-23 03:19 -0500
Re: VFX code quality Paul Rubin <no.email@nospam.invalid> - 2012-05-24 22:51 -0700
Re: VFX code quality Paul Rubin <no.email@nospam.invalid> - 2012-05-24 23:16 -0700
Re: VFX code quality Fritz Wuehler <fritz@spamexpire-201205.rodent.frell.theremailer.net> - 2012-05-23 17:36 +0200
Re: VFX code quality Doug Hoffman <glidedog@gmail.com> - 2012-05-21 12:57 -0400
Re: VFX code quality "Elizabeth D. Rather" <erather@forth.com> - 2012-05-21 08:42 -1000
Re: VFX code quality Doug Hoffman <glidedog@gmail.com> - 2012-05-21 19:41 -0400
Re: VFX code quality Paul Rubin <no.email@nospam.invalid> - 2012-05-21 21:53 -0700
Re: VFX code quality Doug Hoffman <glidedog@gmail.com> - 2012-05-22 07:10 -0400
Re: VFX code quality "Elizabeth D. Rather" <erather@forth.com> - 2012-05-21 08:36 -1000
Re: VFX code quality Paul Rubin <no.email@nospam.invalid> - 2012-05-21 21:46 -0700
Re: VFX code quality "Elizabeth D. Rather" <erather@forth.com> - 2012-05-21 20:30 -1000
Re: VFX code quality David Kuehling <dvdkhlng@gmx.de> - 2012-05-22 14:06 +0200
Re: VFX code quality Doug Hoffman <glidedog@gmail.com> - 2012-05-22 08:59 -0400
FP locals (was: VFX code quality) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-05-22 13:39 +0000
Re: FP locals Doug Hoffman <glidedog@gmail.com> - 2012-05-22 14:03 -0400
Re: FP locals (was: VFX code quality) C G Montgomery <cgm@physics.utoledo.edu> - 2012-05-22 18:09 -0400
Re: FP locals (was: VFX code quality) Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-05-23 03:47 -0700
Re: FP locals (was: VFX code quality) "Ed" <invalid@nospam.com> - 2012-05-26 21:03 +1000
Re: FP locals (was: VFX code quality) Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-05-26 04:40 -0700
Re: FP locals (was: VFX code quality) mhx@iae.nl (Marcel Hendrix) - 2012-05-26 18:27 +0200
Re: FP locals (was: VFX code quality) Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-05-26 12:55 -0700
Re: FP locals (was: VFX code quality) BruceMcF <agila61@netscape.net> - 2012-05-26 14:54 -0700
Re: FP locals (was: VFX code quality) Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-05-26 22:02 -0700
Re: FP locals (was: VFX code quality) mhx@iae.nl (Marcel Hendrix) - 2012-05-27 08:50 +0200
Re: FP locals (was: VFX code quality) Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-05-27 05:26 -0700
Re: VFX code quality BruceMcF <agila61@netscape.net> - 2012-05-22 09:04 -0700
Re: VFX code quality "A. K." <akk@nospam.org> - 2012-05-21 09:55 +0200
Re: VFX code quality Paul Rubin <no.email@nospam.invalid> - 2012-05-21 01:22 -0700
Re: VFX code quality "A. K." <akk@nospam.org> - 2012-05-21 14:19 +0200
Re: VFX code quality Paul Rubin <no.email@nospam.invalid> - 2012-05-22 12:33 -0700
Re: VFX code quality "A. K." <akk@nospam.org> - 2012-05-22 23:14 +0200
Re: VFX code quality mhx@iae.nl (Marcel Hendrix) - 2012-05-21 20:31 +0200
Re: VFX code quality Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-21 15:17 -0500
Re: VFX code quality BruceMcF <agila61@netscape.net> - 2012-05-21 13:50 -0700
Re: VFX code quality BruceMcF <agila61@netscape.net> - 2012-05-21 16:47 -0700
Re: VFX code quality "Harry Vaderchi" <admin@127.0.0.1> - 2012-05-22 09:57 +0100
Re: VFX code quality BruceMcF <agila61@netscape.net> - 2012-05-22 04:39 -0700
Re: VFX code quality mhx@iae.nl (Marcel Hendrix) - 2012-05-23 20:25 +0200
Re: VFX code quality BruceMcF <agila61@netscape.net> - 2012-05-23 13:47 -0700
Re: VFX code quality humptydumpty <ouatubi@gmail.com> - 2012-05-21 20:23 +0000
Re: VFX code quality BruceMcF <agila61@netscape.net> - 2012-05-20 20:22 -0700
Re: VFX code quality Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-05-21 10:57 +0000
Re: VFX code quality Bernd Paysan <bernd.paysan@gmx.de> - 2012-05-21 01:35 +0200
Re: VFX code quality Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-05-20 22:44 -0700
Re: VFX code quality Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-05-20 22:53 -0700
Re: VFX code quality Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-21 04:32 -0500
Re: VFX code quality "Elizabeth D. Rather" <erather@forth.com> - 2012-05-21 08:44 -1000
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Paul Rubin <no.email@nospam.invalid> - 2012-05-20 00:58 -0700
Re: I beleive that forth could supplant ruby and perl and python if it wanted to stephenXXX@mpeforth.com (Stephen Pelc) - 2012-05-20 15:09 +0000
Re: I beleive that forth could supplant ruby and perl and python if it wanted to "Rod Pemberton" <do_not_have@notemailntt.cmm> - 2012-05-18 07:20 -0400
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-18 10:22 -0500
Re: I beleive that forth could supplant ruby and perl and python if it wanted to "Rod Pemberton" <do_not_have@notemailntt.cmm> - 2012-05-18 22:09 -0400
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-19 04:20 -0500
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-05-19 13:19 +0000
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-17 18:33 -0500
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-05-18 01:49 -0700
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Paul Rubin <no.email@nospam.invalid> - 2012-05-18 07:59 -0700
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-18 10:32 -0500
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Bernd Paysan <bernd.paysan@gmx.de> - 2012-05-20 17:24 +0200
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Paul Rubin <no.email@nospam.invalid> - 2012-05-20 15:43 -0700
Re: I beleive that forth could supplant ruby and perl and python if it wanted to BruceMcF <agila61@netscape.net> - 2012-05-20 16:03 -0700
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Paul Rubin <no.email@nospam.invalid> - 2012-05-20 16:34 -0700
Re: I beleive that forth could supplant ruby and perl and python if it wanted to BruceMcF <agila61@netscape.net> - 2012-05-20 17:02 -0700
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-21 04:46 -0500
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Paul Rubin <no.email@nospam.invalid> - 2012-05-21 08:33 -0700
Re: I beleive that forth could supplant ruby and perl and python if it wanted to BruceMcF <agila61@netscape.net> - 2012-05-21 12:10 -0700
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-21 04:40 -0500
address units (was: I beleive that forth could supplant ...) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-05-21 14:40 +0000
Re: address units Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-21 10:07 -0500
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-05-21 10:59 +0000
Re: I beleive that forth could supplant ruby and perl and python if it wanted to anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-05-21 14:22 +0000
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Bernd Paysan <bernd.paysan@gmx.de> - 2012-05-18 00:43 +0200
Re: I beleive that forth could supplant ruby and perl and python if it wanted to vandys@vsta.org - 2012-05-17 23:10 +0000
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Doug Hoffman <glidedog@gmail.com> - 2012-05-17 19:24 -0400
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-05-17 18:38 -0500
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-05-17 22:30 +0000
Re: I beleive that forth could supplant ruby and perl and python if it wanted to BruceMcF <agila61@netscape.net> - 2012-05-17 10:59 -0700
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Jan Coombs <jan_2011-02@murray-microft.co.uk> - 2012-05-20 13:14 +0100
Re: I beleive that forth could supplant ruby and perl and python if it wanted to marko <marko@marko.marko> - 2012-05-18 11:46 +1000
Re: I beleive that forth could supplant ruby and perl and python if it wanted to "Elizabeth D. Rather" <erather@forth.com> - 2012-05-17 20:10 -1000
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Arnold Doray <invalid@invalid.com> - 2012-05-18 10:32 +0000
Re: I beleive that forth could supplant ruby and perl and python if it wanted to marko <marko@marko.marko> - 2012-05-18 21:27 +1000
Re: I beleive that forth could supplant ruby and perl and python if it wanted to Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-05-18 22:58 -0700
Page 5 of 8 — ← Prev page 1 2 3 4 [5] 6 7 8 Next page →
| From | Doug Hoffman <glidedog@gmail.com> |
|---|---|
| Date | 2012-05-21 19:41 -0400 |
| Subject | Re: VFX code quality |
| Message-ID | <4fbad2bc$0$284$14726298@news.sunsite.dk> |
| In reply to | #12354 |
On 5/21/12 2:42 PM, Elizabeth D. Rather wrote:
> On 5/21/12 6:57 AM, Doug Hoffman wrote:
>> On 5/21/12 4:27 AM, Paul Rubin wrote:
>>> : z* { a b c d -- x y }
>>> a c * b d * - b c * a d * + ;
>> Some approach this sort of thing with the mindset that the computer and
>> software, even Forth, are there to service the human. If the locals
>> solution above is fast enough and fits in memory then I would simply use
>> it. Forth-like and un-Forth-like are idioms whose definitions are
>> elusive, or so it seems to me. Btw, locals are in the Forth standard.
>
> There is no way that a high-level definition, with or without locals, is
> going to be anywhere near as fast or as small as a code primitive for
> this kind of operation except with an aggressive optimizing compiler.
> Even then, the code version is probably easier to write.
Using a PowerPC with an optimizing compiler:
: z* { a b c d -- x y }
a c * b d * - b c * a d * + ;
disasm_word z*
: Z* leaf #stk-cells: 0 #parms: 4 #locals: 0 #res: 2
mullw r9, r29, r31
mullw r8, r28, r30
subf r3, r8, r9
mullw r6, r29, r30
mullw r5, r28, r31
add r4, r5, r6
blr
> Part of "the Forth way" is to use the
> tool appropriate for the job: code, in this case.
Really?
-Doug
[toc] | [prev] | [next] | [standalone]
| From | Paul Rubin <no.email@nospam.invalid> |
|---|---|
| Date | 2012-05-21 21:53 -0700 |
| Subject | Re: VFX code quality |
| Message-ID | <7x8vgkq0jv.fsf@ruckus.brouhaha.com> |
| In reply to | #12361 |
Doug Hoffman <glidedog@gmail.com> writes:
> Using a PowerPC with an optimizing compiler:
> : z* { a b c d -- x y }
> a c * b d * - b c * a d * + ;
Chuck might have preferred to save a multiplication, for machines
with no multiplier hardware:
: z* { a b c d -- x y }
a c * { ac } b d * { bd }
ac bd -
a b + c d + * ac - bd - ;
http://mathworld.wolfram.com/ComplexMultiplication.html
What compiler are you using?
[toc] | [prev] | [next] | [standalone]
| From | Doug Hoffman <glidedog@gmail.com> |
|---|---|
| Date | 2012-05-22 07:10 -0400 |
| Subject | Re: VFX code quality |
| Message-ID | <4fbb740d$0$282$14726298@news.sunsite.dk> |
| In reply to | #12364 |
On 5/22/12 12:53 AM, Paul Rubin wrote:
> Doug Hoffman<glidedog@gmail.com> writes:
>> Using a PowerPC with an optimizing compiler:
>> : z* { a b c d -- x y }
>> a c * b d * - b c * a d * + ;
>
> Chuck might have preferred to save a multiplication, for machines
> with no multiplier hardware:
>
> : z* { a b c d -- x y }
> a c * { ac } b d * { bd }
> ac bd -
> a b + c d + * ac - bd - ;
>
> http://mathworld.wolfram.com/ComplexMultiplication.html
>
> What compiler are you using?
Mike Hore's PowerMops.
: z* { a b c d \ ac bd -- x y }
a c * -> ac b d * -> bd
ac bd -
a b + c d + * ac - bd - ;
disasm_word z*
: Z* leaf #stk-cells: 0 #parms: 4 #locals: 2 #res: 2
mullw r27, r29, r31
mullw r26, r28, r30
subf r3, r26, r27
add r8, r30, r31
add r7, r28, r29
mullw r6, r7, r8
subf r5, r27, r6
subf r4, r26, r5
blr
-Doug
[toc] | [prev] | [next] | [standalone]
| From | "Elizabeth D. Rather" <erather@forth.com> |
|---|---|
| Date | 2012-05-21 08:36 -1000 |
| Subject | Re: VFX code quality |
| Message-ID | <OOudnVB1WpuAFifSnZ2dnUVZ_jCdnZ2d@supernews.com> |
| In reply to | #12333 |
On 5/20/12 10:27 PM, Paul Rubin wrote:
> "Elizabeth D. Rather"<erather@forth.com> writes:
>>> : z* ( a b c d -- ac-bd bc+ad )
>>> .... ;
>>
>> I don't understand your stack comment (I'm no mathematician)
>
> ac-bd just means a*c minus b*d. So the word takes 4 parameters a,b,c,d
> representing the two complex numbers a+bi and c+di. It multiplies them
> leaving the single complex number (ac-bd) + i*(bc+ad), as two
> coefficients on the stack. It's trivial with locals:
>
> : z* { a b c d -- x y }
> a c * b d * - b c * a d * + ;
>
> doing it without locals seems quite inconvenient. I think Chuck might
> have used globals.
No, he did that sort of thing as a code primitive, using registers.
Cheers,
Elizabeth
--
==================================================
Elizabeth D. Rather (US & Canada) 800-55-FORTH
FORTH Inc. +1 310.999.6784
5959 West Century Blvd. Suite 700
Los Angeles, CA 90045
http://www.forth.com
"Forth-based products and Services for real-time
applications since 1973."
==================================================
[toc] | [prev] | [next] | [standalone]
| From | Paul Rubin <no.email@nospam.invalid> |
|---|---|
| Date | 2012-05-21 21:46 -0700 |
| Subject | Re: VFX code quality |
| Message-ID | <7xd35wq0ux.fsf@ruckus.brouhaha.com> |
| In reply to | #12353 |
"Elizabeth D. Rather" <erather@forth.com> writes: >> doing it without locals seems quite inconvenient. I think Chuck might >> have used globals. > No, he did that sort of thing as a code primitive, using registers. Right, I didn't understand at first, but on conventional computers that sounds workable. On Chuck's stack-based computers with (almost) no registers, I think that leaves globals. I've looked at a little GA144 code (not enough to spot things like this) and want to take a look at Cmforth (for the Novix) one of these days.
[toc] | [prev] | [next] | [standalone]
| From | "Elizabeth D. Rather" <erather@forth.com> |
|---|---|
| Date | 2012-05-21 20:30 -1000 |
| Subject | Re: VFX code quality |
| Message-ID | <g4idnTGRgrQYrybSnZ2dnUVZ_qOdnZ2d@supernews.com> |
| In reply to | #12363 |
On 5/21/12 6:46 PM, Paul Rubin wrote: > "Elizabeth D. Rather"<erather@forth.com> writes: >>> doing it without locals seems quite inconvenient. I think Chuck might >>> have used globals. >> No, he did that sort of thing as a code primitive, using registers. > > Right, I didn't understand at first, but on conventional computers that > sounds workable. On Chuck's stack-based computers with (almost) no > registers, I think that leaves globals. I've looked at a little GA144 > code (not enough to spot things like this) and want to take a look at > Cmforth (for the Novix) one of these days. I would be amused to see how Chuck would do this in high level on the GA144, since he hates locals! But, in fact, he works in what is equivalent to an assembler to the GA144, so I suppose he would continue in that vein. If the processor doesn't have many registers, there's no option for optimizing using registers, is there? Cheers, Elizabeth -- ================================================== Elizabeth D. Rather (US & Canada) 800-55-FORTH FORTH Inc. +1 310.999.6784 5959 West Century Blvd. Suite 700 Los Angeles, CA 90045 http://www.forth.com "Forth-based products and Services for real-time applications since 1973." ==================================================
[toc] | [prev] | [next] | [standalone]
| From | David Kuehling <dvdkhlng@gmx.de> |
|---|---|
| Date | 2012-05-22 14:06 +0200 |
| Subject | Re: VFX code quality |
| Message-ID | <87vcjoju89.fsf@snail.Pool> |
| In reply to | #12333 |
>>>>> "Paul" == Paul Rubin <no.email@nospam.invalid> writes:
> "Elizabeth D. Rather" <erather@forth.com> writes:
>>> : z* ( a b c d -- ac-bd bc+ad ) .... ;
>>
>> I don't understand your stack comment (I'm no mathematician)
> ac-bd just means a*c minus b*d. So the word takes 4 parameters
> a,b,c,d representing the two complex numbers a+bi and c+di. It
> multiplies them leaving the single complex number (ac-bd) + i*(bc+ad),
> as two coefficients on the stack. It's trivial with locals:
> : z* { a b c d -- x y } a c * b d * - b c * a d * + ;
> doing it without locals seems quite inconvenient. I think Chuck might
> have used globals.
Well not too inconvenient, this is what I came up some time ago:
: z* ( n1 n2 n3 n4 -- n5 n6 )
2OVER 2OVER
-ROT r* -ROT r* r+ >R ( imag )
ROT r* >R r* R> r- ( real )
R> ;
this is for single-cell entities. Of course with floats you can't use
>R R> which would screw you (but on the other hand floating point locals
aren't supported by the standard).
David
--
GnuPG public key: http://dvdkhlng.users.sourceforge.net/dk.gpg
Fingerprint: B17A DC95 D293 657B 4205 D016 7DEF 5323 C174 7D40
[toc] | [prev] | [next] | [standalone]
| From | Doug Hoffman <glidedog@gmail.com> |
|---|---|
| Date | 2012-05-22 08:59 -0400 |
| Subject | Re: VFX code quality |
| Message-ID | <4fbb8d99$0$282$14726298@news.sunsite.dk> |
| In reply to | #12379 |
On 5/22/12 8:06 AM, David Kuehling wrote:
> but on the other hand floating point locals
> aren't supported by the standard.
Floating point locals can be written using standard Forth. Does that
make them supported?
: z*f f{ a b c d -- x y }
a c f* b d f* f- b c f* a d f* f+ ;
-Doug
[toc] | [prev] | [next] | [standalone]
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Date | 2012-05-22 13:39 +0000 |
| Subject | FP locals (was: VFX code quality) |
| Message-ID | <2012May22.153912@mips.complang.tuwien.ac.at> |
| In reply to | #12381 |
Doug Hoffman <glidedog@gmail.com> writes:
>Floating point locals can be written using standard Forth.
How?
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2012: http://www.euroforth.org/ef12/
[toc] | [prev] | [next] | [standalone]
| From | Doug Hoffman <glidedog@gmail.com> |
|---|---|
| Date | 2012-05-22 14:03 -0400 |
| Subject | Re: FP locals |
| Message-ID | <4fbbd4f0$0$290$14726298@news.sunsite.dk> |
| In reply to | #12382 |
On 5/22/12 9:39 AM, Anton Ertl wrote: > Doug Hoffman<glidedog@gmail.com> writes: >> Floating point locals can be written using standard Forth. > > How? My mistake. I don't see how that could be done. Sorry. -Doug
[toc] | [prev] | [next] | [standalone]
| From | C G Montgomery <cgm@physics.utoledo.edu> |
|---|---|
| Date | 2012-05-22 18:09 -0400 |
| Subject | Re: FP locals (was: VFX code quality) |
| Message-ID | <jph2r1$vrq$1@dont-email.me> |
| In reply to | #12382 |
Anton Ertl anton@mips.complang.tuwien.ac.at wrote:
> Doug Hoffman <glidedog@gmail.com> writes:
>>Floating point locals can be written using standard Forth.
>
> How?
>
> - anton
The Forth Scientific Library provides a form of floating point locals, in
its fslutil files. It could be argued that they aren't truly fp locals,
in syntax for example. But they can be used for fp locals, and they are
written in standard Forth.
Perhaps not too lengthy to quote, to save readers from looking them up:
\ ================ Floating-point local variables =====================
\ example: : test 2e 3e FRAME| a b | a f. b f. |FRAME ;
\ test <cr> 3.0000 2.0000 ok
\ gforth has floating locals which are nicer but less portable.
8 CONSTANT /flocals
: (frame) ( n -- ) FLOATS ALLOT ;
: FRAME|
0 >R
BEGIN BL WORD COUNT 1 =
SWAP C@ [CHAR] | =
AND 0=
WHILE POSTPONE F, R> 1+ >R
REPEAT
/FLOCALS R> - DUP 0< ABORT" too many flocals"
POSTPONE LITERAL POSTPONE (frame) ; IMMEDIATE
: |FRAME ( -- ) [ /FLOCALS NEGATE ] LITERAL (frame) ;
\ use a defining word to build locals cgm
: lcl ( n -- ) CREATE ,
DOES> @ FLOATS NEGATE HERE +
;
8 lcl &a 7 lcl &b 6 lcl &c 5 lcl &d
: a &a F@ ; : b &b F@ ; : c &c F@ ; : d &d F@ ;
4 lcl &e 3 lcl &f 2 lcl &g 1 lcl &h
: e &e F@ ; : f &f F@ ; : g &g F@ ; : h &h F@ ;
regards cgm
[toc] | [prev] | [next] | [standalone]
| From | Krishna Myneni <krishna.myneni@ccreweb.org> |
|---|---|
| Date | 2012-05-23 03:47 -0700 |
| Subject | Re: FP locals (was: VFX code quality) |
| Message-ID | <a9873d6a-501a-4d9b-80aa-923693962ba8@j3g2000yqb.googlegroups.com> |
| In reply to | #12397 |
On May 22, 5:09 pm, C G Montgomery <c...@physics.utoledo.edu> wrote: > Anton Ertl an...@mips.complang.tuwien.ac.at wrote: > > Doug Hoffman <glide...@gmail.com> writes: > >>Floating point locals can be written using standard Forth. > > > How? > > > - anton > > The Forth Scientific Library provides a form of floating point locals, in > its fslutil files. It could be argued that they aren't truly fp locals, > in syntax for example. But they can be used for fp locals, and they are > written in standard Forth. > > Perhaps not too lengthy to quote, to save readers from looking them up: > > \ ================ Floating-point local variables ===================== > \ example: : test 2e 3e FRAME| a b | a f. b f. |FRAME ; > \ test <cr> 3.0000 2.0000 ok > \ gforth has floating locals which are nicer but less portable. > > 8 CONSTANT /flocals > > : (frame) ( n -- ) FLOATS ALLOT ; > > : FRAME| > 0 >R > BEGIN BL WORD COUNT 1 = > SWAP C@ [CHAR] | = > AND 0= > WHILE POSTPONE F, R> 1+ >R > REPEAT > /FLOCALS R> - DUP 0< ABORT" too many flocals" > POSTPONE LITERAL POSTPONE (frame) ; IMMEDIATE > > : |FRAME ( -- ) [ /FLOCALS NEGATE ] LITERAL (frame) ; > > \ use a defining word to build locals cgm > : lcl ( n -- ) CREATE , > DOES> @ FLOATS NEGATE HERE + > ; > > 8 lcl &a 7 lcl &b 6 lcl &c 5 lcl &d > : a &a F@ ; : b &b F@ ; : c &c F@ ; : d &d F@ ; > 4 lcl &e 3 lcl &f 2 lcl &g 1 lcl &h > : e &e F@ ; : f &f F@ ; : g &g F@ ; : h &h F@ ; > > regards cgm Defining the symbols "a" through "e" in the Forth wordlist simply isn't practical, and I comment out the fp locals section of my Forth auxiliary file (fsl-util.x). Krishna
[toc] | [prev] | [next] | [standalone]
| From | "Ed" <invalid@nospam.com> |
|---|---|
| Date | 2012-05-26 21:03 +1000 |
| Subject | Re: FP locals (was: VFX code quality) |
| Message-ID | <jpqdca$idu$1@speranza.aioe.org> |
| In reply to | #12412 |
Krishna Myneni wrote: > On May 22, 5:09 pm, C G Montgomery <c...@physics.utoledo.edu> wrote: > > ... > > The Forth Scientific Library provides a form of floating point locals, in > > its fslutil files. It could be argued that they aren't truly fp locals, > > in syntax for example. But they can be used for fp locals, and they are > > written in standard Forth. > > > > Perhaps not too lengthy to quote, to save readers from looking them up: > > > > \ ================ Floating-point local variables ===================== > > \ example: : test 2e 3e FRAME| a b | a f. b f. |FRAME ; > > \ test <cr> 3.0000 2.0000 ok > > \ gforth has floating locals which are nicer but less portable. > > > > 8 CONSTANT /flocals > > > > : (frame) ( n -- ) FLOATS ALLOT ; > > > > : FRAME| > > 0 >R > > BEGIN BL WORD COUNT 1 = > > SWAP C@ [CHAR] | = > > AND 0= > > WHILE POSTPONE F, R> 1+ >R > > REPEAT > > /FLOCALS R> - DUP 0< ABORT" too many flocals" > > POSTPONE LITERAL POSTPONE (frame) ; IMMEDIATE > > > > : |FRAME ( -- ) [ /FLOCALS NEGATE ] LITERAL (frame) ; > > > > \ use a defining word to build locals cgm > > : lcl ( n -- ) CREATE , > > DOES> @ FLOATS NEGATE HERE + > > ; > > > > 8 lcl &a 7 lcl &b 6 lcl &c 5 lcl &d > > : a &a F@ ; : b &b F@ ; : c &c F@ ; : d &d F@ ; > > 4 lcl &e 3 lcl &f 2 lcl &g 1 lcl &h > > : e &e F@ ; : f &f F@ ; : g &g F@ ; : h &h F@ ; > > > > regards cgm > > Defining the symbols "a" through "e" in the Forth wordlist simply > isn't practical, and I comment out the fp locals section of my Forth > auxiliary file (fsl-util.x). What is impractical about using "a" through "e" ? Single-letter commands in Forth have typically been used as 'quick keys' to utility functions with longer names. Apps overwriting them may be inconvenient but not a disaster.
[toc] | [prev] | [next] | [standalone]
| From | Krishna Myneni <krishna.myneni@ccreweb.org> |
|---|---|
| Date | 2012-05-26 04:40 -0700 |
| Subject | Re: FP locals (was: VFX code quality) |
| Message-ID | <32ede544-8517-493b-907c-7c35b982ead4@t20g2000yqn.googlegroups.com> |
| In reply to | #12464 |
On May 26, 6:03 am, "Ed" <inva...@nospam.com> wrote: > Krishna Myneni wrote: > > On May 22, 5:09 pm, C G Montgomery <c...@physics.utoledo.edu> wrote: > > > ... > > > The Forth Scientific Library provides a form of floating point locals, in > > > its fslutil files. It could be argued that they aren't truly fp locals, > > > in syntax for example. But they can be used for fp locals, and they are > > > written in standard Forth. > > > > Perhaps not too lengthy to quote, to save readers from looking them up: > > > > \ ================ Floating-point local variables ===================== > > > \ example: : test 2e 3e FRAME| a b | a f. b f. |FRAME ; > > > \ test <cr> 3.0000 2.0000 ok > > > \ gforth has floating locals which are nicer but less portable. > > > > 8 CONSTANT /flocals > > > > : (frame) ( n -- ) FLOATS ALLOT ; > > > > : FRAME| > > > 0 >R > > > BEGIN BL WORD COUNT 1 = > > > SWAP C@ [CHAR] | = > > > AND 0= > > > WHILE POSTPONE F, R> 1+ >R > > > REPEAT > > > /FLOCALS R> - DUP 0< ABORT" too many flocals" > > > POSTPONE LITERAL POSTPONE (frame) ; IMMEDIATE > > > > : |FRAME ( -- ) [ /FLOCALS NEGATE ] LITERAL (frame) ; > > > > \ use a defining word to build locals cgm > > > : lcl ( n -- ) CREATE , > > > DOES> @ FLOATS NEGATE HERE + > > > ; > > > > 8 lcl &a 7 lcl &b 6 lcl &c 5 lcl &d > > > : a &a F@ ; : b &b F@ ; : c &c F@ ; : d &d F@ ; > > > 4 lcl &e 3 lcl &f 2 lcl &g 1 lcl &h > > > : e &e F@ ; : f &f F@ ; : g &g F@ ; : h &h F@ ; > > > > regards cgm > > > Defining the symbols "a" through "e" in the Forth wordlist simply > > isn't practical, and I comment out the fp locals section of my Forth > > auxiliary file (fsl-util.x). > > What is impractical about using "a" through "e" ? > > Single-letter commands in Forth have typically been used > as 'quick keys' to utility functions with longer names. Apps > overwriting them may be inconvenient but not a disaster. It's actually "a" through "h" in my fsl-util.x file. These symbols are not redefined for each instance in the FSL aux file implementation. The following would likely happen: : func1 ( F: r1 r2 -- ) FRAME| b a | ... ; : func2 ( F: r1 -- ) FRAME| a | ... func1 ... a ; That's a flaw with the FSL implementation of fp locals. However, "a"--"h" are typically likely to be used for variable names (at least I use them readily). The FSL implementation would mask them inside of a word, regardless of implementation. Krishna
[toc] | [prev] | [next] | [standalone]
| From | mhx@iae.nl (Marcel Hendrix) |
|---|---|
| Date | 2012-05-26 18:27 +0200 |
| Subject | Re: FP locals (was: VFX code quality) |
| Message-ID | <96081709988435@frunobulax.edu> |
| In reply to | #12465 |
Krishna Myneni <krishna.myneni@ccreweb.org> writes Re: FP locals (was: VFX code quality)
> On May 26, 6:03=A0am, "Ed" <inva...@nospam.com> wrote:
>> Krishna Myneni wrote:
>>> On May 22, 5:09 pm, C G Montgomery <c...@physics.utoledo.edu> wrote:
...
>>> The Forth Scientific Library provides a form of floating point locals, in
>>> its fslutil files. It could be argued that they aren't truly fp locals,
>>> in syntax for example. But they can be used for fp locals, and they are
>>> written in standard Forth.
[..]
> It's actually "a" through "h" in my fsl-util.x file. These symbols are
> not redefined for each instance in the FSL aux file implementation.
> The following would likely happen:
> : func1 ( F: r1 r2 -- ) FRAME| b a | ... ;
> : func2 ( F: r1 -- ) FRAME| a | ... func1 ... a ;
> That's a flaw with the FSL implementation of fp locals. However,
> "a"--"h" are typically likely to be used for variable names (at least
> I use them readily). The FSL implementation would mask them inside of
> a word, regardless of implementation.
Are you sure you know how to use them ( |FRAME ) ?
It works for me when I add two FALIGNs.
-marcel
8 CONSTANT /flocals
: (frame) ( n -- ) FALIGN FLOATS ALLOT ;
: |FRAME ( n -- ) /flocals NEGATE (frame) ;
: FRAME|
0 >R BEGIN BL WORD COUNT 1 =
SWAP C@ [CHAR] | = AND 0=
WHILE R@ 0= IF POSTPONE FALIGN ENDIF
POSTPONE F, R> 1+ >R
REPEAT
/flocals R> - DUP 0< ABORT" too many flocals"
POSTPONE LITERAL POSTPONE (frame) ; IMMEDIATE
: &h HERE 1 FLOATS - ;
: &g HERE 2 FLOATS - ;
: &f HERE 3 FLOATS - ;
: &e HERE 4 FLOATS - ;
: &d HERE 5 FLOATS - ;
: &c HERE 6 FLOATS - ;
: &b HERE 7 FLOATS - ;
: &a HERE 8 FLOATS - ;
: a &a F@ ;
: b &b F@ ;
: c &c F@ ;
: d &d F@ ;
: e &e F@ ;
: f &f F@ ;
: g &g F@ ;
: h &h F@ ;
: func1 ( F: r1 r2 -- r3 ) FRAME| b a | CR ." b = " b F. ." a = " a F. a b F+ ." a + b = " FDUP F. |FRAME ;
: func2 ( F: r1 -- ) FRAME| a | CR ." a = " a F. PI LN2 func1 CR ." a = " a F. ." result = " a F* F. |FRAME ;
12.34e func2
a = 12.340000
a = 0.693147 b = 3.141593 a + b = 3.834740
a = 12.340000 result = 47.320690 ok
[toc] | [prev] | [next] | [standalone]
| From | Krishna Myneni <krishna.myneni@ccreweb.org> |
|---|---|
| Date | 2012-05-26 12:55 -0700 |
| Subject | Re: FP locals (was: VFX code quality) |
| Message-ID | <c7da8377-98b3-4f2c-be13-8befa459dcaf@w19g2000yqb.googlegroups.com> |
| In reply to | #12475 |
On May 26, 11:27 am, m...@iae.nl (Marcel Hendrix) wrote: > Krishna Myneni <krishna.myn...@ccreweb.org> writes Re: FP locals (was: VFX code quality) > > > > > > > > > > > > > On May 26, 6:03=A0am, "Ed" <inva...@nospam.com> wrote: > >> Krishna Myneni wrote: > >>> On May 22, 5:09 pm, C G Montgomery <c...@physics.utoledo.edu> wrote: > ... > >>> The Forth Scientific Library provides a form of floating point locals, in > >>> its fslutil files. It could be argued that they aren't truly fp locals, > >>> in syntax for example. But they can be used for fp locals, and they are > >>> written in standard Forth. > [..] > > It's actually "a" through "h" in my fsl-util.x file. These symbols are > > not redefined for each instance in the FSL aux file implementation. > > The following would likely happen: > > : func1 ( F: r1 r2 -- ) FRAME| b a | ... ; > > : func2 ( F: r1 -- ) FRAME| a | ... func1 ... a ; > > That's a flaw with the FSL implementation of fp locals. However, > > "a"--"h" are typically likely to be used for variable names (at least > > I use them readily). The FSL implementation would mask them inside of > > a word, regardless of implementation. > > Are you sure you know how to use them ( |FRAME ) ? > It works for me when I add two FALIGNs. > > -marcel > > 8 CONSTANT /flocals > > : (frame) ( n -- ) FALIGN FLOATS ALLOT ; > : |FRAME ( n -- ) /flocals NEGATE (frame) ; > > : FRAME| > 0 >R BEGIN BL WORD COUNT 1 = > SWAP C@ [CHAR] | = AND 0= > WHILE R@ 0= IF POSTPONE FALIGN ENDIF > POSTPONE F, R> 1+ >R > REPEAT > /flocals R> - DUP 0< ABORT" too many flocals" > POSTPONE LITERAL POSTPONE (frame) ; IMMEDIATE > > : &h HERE 1 FLOATS - ; > : &g HERE 2 FLOATS - ; > : &f HERE 3 FLOATS - ; > : &e HERE 4 FLOATS - ; > : &d HERE 5 FLOATS - ; > : &c HERE 6 FLOATS - ; > : &b HERE 7 FLOATS - ; > : &a HERE 8 FLOATS - ; > > : a &a F@ ; > : b &b F@ ; > : c &c F@ ; > : d &d F@ ; > : e &e F@ ; > : f &f F@ ; > : g &g F@ ; > : h &h F@ ; > > : func1 ( F: r1 r2 -- r3 ) FRAME| b a | CR ." b = " b F. ." a = " a F. a b F+ ." a + b = " FDUP F. |FRAME ; > : func2 ( F: r1 -- ) FRAME| a | CR ." a = " a F. PI LN2 func1 CR ." a = " a F. ." result = " a F* F. |FRAME ; > > 12.34e func2 > a = 12.340000 > a = 0.693147 b = 3.141593 a + b = 3.834740 > a = 12.340000 result = 47.320690 ok You're right. I misremembered and my example was wrong. That wasn't the reason I didn't want to use them. The reason I didn't want to use them is that subsequently defined variables will mask the fixed FLOCALS names. I didn't want to be restricted in using "a" through "h" for variable or fvariable names. Krishna
[toc] | [prev] | [next] | [standalone]
| From | BruceMcF <agila61@netscape.net> |
|---|---|
| Date | 2012-05-26 14:54 -0700 |
| Subject | Re: FP locals (was: VFX code quality) |
| Message-ID | <813e870b-571e-4631-8935-62f5a6f0455f@e20g2000vbm.googlegroups.com> |
| In reply to | #12478 |
On May 26, 3:55 pm, Krishna Myneni <krishna.myn...@ccreweb.org> wrote: > On May 26, 11:27 am, m...@iae.nl (Marcel Hendrix) wrote: > > > > > > > > > > > Krishna Myneni <krishna.myn...@ccreweb.org> writes Re: FP locals (was: VFX code quality) > > > > On May 26, 6:03=A0am, "Ed" <inva...@nospam.com> wrote: > > >> Krishna Myneni wrote: > > >>> On May 22, 5:09 pm, C G Montgomery <c...@physics.utoledo.edu> wrote: > > ... > > >>> The Forth Scientific Library provides a form of floating point locals, in > > >>> its fslutil files. It could be argued that they aren't truly fp locals, > > >>> in syntax for example. But they can be used for fp locals, and they are > > >>> written in standard Forth. > > [..] > > > It's actually "a" through "h" in my fsl-util.x file. These symbols are > > > not redefined for each instance in the FSL aux file implementation. > > > The following would likely happen: > > > : func1 ( F: r1 r2 -- ) FRAME| b a | ... ; > > > : func2 ( F: r1 -- ) FRAME| a | ... func1 ... a ; > > > That's a flaw with the FSL implementation of fp locals. However, > > > "a"--"h" are typically likely to be used for variable names (at least > > > I use them readily). The FSL implementation would mask them inside of > > > a word, regardless of implementation. > > > Are you sure you know how to use them ( |FRAME ) ? > > It works for me when I add two FALIGNs. > > > -marcel > > > 8 CONSTANT /flocals > > > : (frame) ( n -- ) FALIGN FLOATS ALLOT ; > > : |FRAME ( n -- ) /flocals NEGATE (frame) ; > > > : FRAME| > > 0 >R BEGIN BL WORD COUNT 1 = > > SWAP C@ [CHAR] | = AND 0= > > WHILE R@ 0= IF POSTPONE FALIGN ENDIF > > POSTPONE F, R> 1+ >R > > REPEAT > > /flocals R> - DUP 0< ABORT" too many flocals" > > POSTPONE LITERAL POSTPONE (frame) ; IMMEDIATE > > > : &h HERE 1 FLOATS - ; > > : &g HERE 2 FLOATS - ; > > : &f HERE 3 FLOATS - ; > > : &e HERE 4 FLOATS - ; > > : &d HERE 5 FLOATS - ; > > : &c HERE 6 FLOATS - ; > > : &b HERE 7 FLOATS - ; > > : &a HERE 8 FLOATS - ; > > > : a &a F@ ; > > : b &b F@ ; > > : c &c F@ ; > > : d &d F@ ; > > : e &e F@ ; > > : f &f F@ ; > > : g &g F@ ; > > : h &h F@ ; > > > : func1 ( F: r1 r2 -- r3 ) FRAME| b a | CR ." b = " b F. ." a = " a F. a b F+ ." a + b = " FDUP F. |FRAME ; > > : func2 ( F: r1 -- ) FRAME| a | CR ." a = " a F. PI LN2 func1 CR ." a = " a F. ." result = " a F* F. |FRAME ; > > > 12.34e func2 > > a = 12.340000 > > a = 0.693147 b = 3.141593 a + b = 3.834740 > > a = 12.340000 result = 47.320690 ok > > You're right. I misremembered and my example was wrong. That wasn't > the reason I didn't want to use them. > > The reason I didn't want to use them is that subsequently defined > variables will mask the fixed FLOCALS names. I didn't want to be > restricted in using "a" through "h" for variable or fvariable names. Could that be fixed with the search order stack? I guess you'd need: : ... FRAME| ... |FRAME ... FRAME; But then the locals not in use would mask those variables that are, so you'd not be restricted in using "a" through "h" for fvariable names, but they couldn't mingle in a word using the FLOCALS.
[toc] | [prev] | [next] | [standalone]
| From | Krishna Myneni <krishna.myneni@ccreweb.org> |
|---|---|
| Date | 2012-05-26 22:02 -0700 |
| Subject | Re: FP locals (was: VFX code quality) |
| Message-ID | <ed38f6ba-e19d-4949-a2bb-806f9cb74e1a@w19g2000yqb.googlegroups.com> |
| In reply to | #12480 |
On May 26, 4:54 pm, BruceMcF <agil...@netscape.net> wrote: > On May 26, 3:55 pm, Krishna Myneni <krishna.myn...@ccreweb.org> wrote: > > > > > > > > > > > On May 26, 11:27 am, m...@iae.nl (Marcel Hendrix) wrote: > > > > Krishna Myneni <krishna.myn...@ccreweb.org> writes Re: FP locals (was: VFX code quality) > > > > > On May 26, 6:03=A0am, "Ed" <inva...@nospam.com> wrote: > > > >> Krishna Myneni wrote: > > > >>> On May 22, 5:09 pm, C G Montgomery <c...@physics.utoledo.edu> wrote: > > > ... > > > >>> The Forth Scientific Library provides a form of floating point locals, in > > > >>> its fslutil files. It could be argued that they aren't truly fp locals, > > > >>> in syntax for example. But they can be used for fp locals, and they are > > > >>> written in standard Forth. > > > [..] > > > > It's actually "a" through "h" in my fsl-util.x file. These symbols are > > > > not redefined for each instance in the FSL aux file implementation. > > > > The following would likely happen: > > > > : func1 ( F: r1 r2 -- ) FRAME| b a | ... ; > > > > : func2 ( F: r1 -- ) FRAME| a | ... func1 ... a ; > > > > That's a flaw with the FSL implementation of fp locals. However, > > > > "a"--"h" are typically likely to be used for variable names (at least > > > > I use them readily). The FSL implementation would mask them inside of > > > > a word, regardless of implementation. > > > > Are you sure you know how to use them ( |FRAME ) ? > > > It works for me when I add two FALIGNs. > > > > -marcel > > > > 8 CONSTANT /flocals > > > > : (frame) ( n -- ) FALIGN FLOATS ALLOT ; > > > : |FRAME ( n -- ) /flocals NEGATE (frame) ; > > > > : FRAME| > > > 0 >R BEGIN BL WORD COUNT 1 = > > > SWAP C@ [CHAR] | = AND 0= > > > WHILE R@ 0= IF POSTPONE FALIGN ENDIF > > > POSTPONE F, R> 1+ >R > > > REPEAT > > > /flocals R> - DUP 0< ABORT" too many flocals" > > > POSTPONE LITERAL POSTPONE (frame) ; IMMEDIATE > > > > : &h HERE 1 FLOATS - ; > > > : &g HERE 2 FLOATS - ; > > > : &f HERE 3 FLOATS - ; > > > : &e HERE 4 FLOATS - ; > > > : &d HERE 5 FLOATS - ; > > > : &c HERE 6 FLOATS - ; > > > : &b HERE 7 FLOATS - ; > > > : &a HERE 8 FLOATS - ; > > > > : a &a F@ ; > > > : b &b F@ ; > > > : c &c F@ ; > > > : d &d F@ ; > > > : e &e F@ ; > > > : f &f F@ ; > > > : g &g F@ ; > > > : h &h F@ ; > > > > : func1 ( F: r1 r2 -- r3 ) FRAME| b a | CR ." b = " b F. ." a = " a F. a b F+ ." a + b = " FDUP F. |FRAME ; > > > : func2 ( F: r1 -- ) FRAME| a | CR ." a = " a F. PI LN2 func1 CR ." a = " a F. ." result = " a F* F. |FRAME ; > > > > 12.34e func2 > > > a = 12.340000 > > > a = 0.693147 b = 3.141593 a + b = 3.834740 > > > a = 12.340000 result = 47.320690 ok > > > You're right. I misremembered and my example was wrong. That wasn't > > the reason I didn't want to use them. > > > The reason I didn't want to use them is that subsequently defined > > variables will mask the fixed FLOCALS names. I didn't want to be > > restricted in using "a" through "h" for variable or fvariable names. > > Could that be fixed with the search order stack? I guess you'd need: > > : ... FRAME| ... |FRAME ... FRAME; > Yes, but if I was going to go to the trouble of manipulating the search order stack, I'd just use that provision which is already provided by the modules system. The older modules system, and the newer one developed by DNW and myself obviate the need to use FLOCALS. Our system has the advantage of being able to reference module- specific names within a word, with no run-time penalty, when named modules are used. FLOCALS just aren't worth the trouble for me. Krishna
[toc] | [prev] | [next] | [standalone]
| From | mhx@iae.nl (Marcel Hendrix) |
|---|---|
| Date | 2012-05-27 08:50 +0200 |
| Subject | Re: FP locals (was: VFX code quality) |
| Message-ID | <19859508988435@frunobulax.edu> |
| In reply to | #12478 |
Krishna Myneni <krishna.myneni@ccreweb.org> writes Re: FP locals (was: VFX code quality) > On May 26, 11:27 am, m...@iae.nl (Marcel Hendrix) wrote: >> Krishna Myneni <krishna.myn...@ccreweb.org> writes Re: FP locals (was: VFX code quality) [..] > You're right. I misremembered and my example was wrong. That wasn't > the reason I didn't want to use them. > The reason I didn't want to use them is that subsequently defined > variables will mask the fixed FLOCALS names. I didn't want to be > restricted in using "a" through "h" for variable or fvariable names. OK. But in all reason: one doesn't call the global variables of a substantial program or library simply a, b, ... h. First, such names are a very poor choice because of their lack of descriptiveness, and second, very soon there would be clashes between global variables themselves more often than with locals. I suspect the FSL flocals are in effect more useful than a cursory scan reveals. For myself, I won't even consider using the FSL locals because of purely subjective esthethic reasons :-) -marcel
[toc] | [prev] | [next] | [standalone]
| From | Krishna Myneni <krishna.myneni@ccreweb.org> |
|---|---|
| Date | 2012-05-27 05:26 -0700 |
| Subject | Re: FP locals (was: VFX code quality) |
| Message-ID | <e4e56b76-b1d6-4e2f-b74d-79c2910935e7@f7g2000yqh.googlegroups.com> |
| In reply to | #12491 |
On May 27, 1:50 am, m...@iae.nl (Marcel Hendrix) wrote: > Krishna Myneni <krishna.myn...@ccreweb.org> writes Re: FP locals (was: VFX code quality) > > > > > On May 26, 11:27 am, m...@iae.nl (Marcel Hendrix) wrote: > >> Krishna Myneni <krishna.myn...@ccreweb.org> writes Re: FP locals (was: VFX code quality) > [..] > > You're right. I misremembered and my example was wrong. That wasn't > > the reason I didn't want to use them. > > The reason I didn't want to use them is that subsequently defined > > variables will mask the fixed FLOCALS names. I didn't want to be > > restricted in using "a" through "h" for variable or fvariable names. > > OK. But in all reason: one doesn't call the global variables of a substantial > program or library simply a, b, ... h. First, such names are a very poor choice > because of their lack of descriptiveness, and second, very soon there would be > clashes between global variables themselves more often than with locals. > Not necessarily. If one is writing a medium/large application scattered across multiple files, without the use of name isolation, then, yes, such names are very poor choices due to the possibility of name clashes. However, with the appropriate use of wordlists, manipulated through a modules framework, such names may be used when they are the most meaningful choices, e.g. in science and engineering applications, one could use the following names to represent the respective quantities: "e" for energy "g" for acceleration due to gravity "a" for radius of a circle "c" for the speed of light "h" for Planck's constant > I suspect the FSL flocals are in effect more useful than a cursory scan reveals. > I've actually tried to make use of them before, but abandoned them due to the name masking issue with common variable names. > For myself, I won't even consider using the FSL locals because of purely > subjective esthethic reasons :-) > Krishna
[toc] | [prev] | [next] | [standalone]
Page 5 of 8 — ← Prev page 1 2 3 4 [5] 6 7 8 Next page →
Back to top | Article view | comp.lang.forth
csiph-web