Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #59943
| From | admin@simple.gopher |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: pforth return stack strangeness |
| Date | 2017-05-27 19:15 +0000 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <ogcj8p$1egr$1@gioia.aioe.org> (permalink) |
| References | <594c406f-a82d-4fbb-beeb-e2760a98641d@googlegroups.com> |
>On Saturday, May 27, 2017 at 12:04:00 PM UTC-5, ad...@simple.gopher wrote: >> Maybe there are some pforth users here.. >> >> QUADRATIC example from page 112 in Starting Forth book: >> % pforth >> / compute a * X^2 + b * X + c >> : QUAD ( a b c X -- n) >R SWAP ROT I * + R> * + ; ok >> 2 7 9 3 QUAD . ==> 30 ok >> >> The answer should be 48. > >The answer's also wrong under SwiftForth. > >You can get the intended answer under both by accessing the top >of the return stack with R@ , rather than I : > > $ ./pforth_standalone > PForth V27-LE/64, built May 27 2017 12:18:53 (static) > > : quad >r swap rot r@ * + r> * + ; 2 7 9 3 quad . 48 ok > Stack<10> Hey nice! Seems to also work with 'ff'[1] forth: % echo ": quad >r swap rot r@ * + r> * + ; 2 7 9 3 quad . cr bye" | ff ok 48 Thanks ; it was probably a very novice question.. J. [1] http://bitbucket.org/bunny351/ff
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
pforth return stack strangeness admin@simple.gopher - 2017-05-27 17:03 +0000
Re: pforth return stack strangeness Julian Fondren <julian.fondren@gmail.com> - 2017-05-27 10:22 -0700
Re: pforth return stack strangeness admin@simple.gopher - 2017-05-27 19:15 +0000
Re: pforth return stack strangeness Julian Fondren <julian.fondren@gmail.com> - 2017-05-27 12:37 -0700
Re: pforth return stack strangeness Roelf Toxopeus <rt4all@nothishetnet.nl> - 2017-05-27 21:10 +0200
csiph-web