Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #59932
| Newsgroups | comp.lang.forth |
|---|---|
| Date | 2017-05-27 10:22 -0700 |
| References | <ogcbht$10da$1@gioia.aioe.org> |
| Message-ID | <594c406f-a82d-4fbb-beeb-e2760a98641d@googlegroups.com> (permalink) |
| Subject | Re: pforth return stack strangeness |
| From | Julian Fondren <julian.fondren@gmail.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>
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