Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #1583
| From | mhx@iae.nl (Marcel Hendrix) |
|---|---|
| Subject | Re: Printing a floating point number |
| Newsgroups | comp.lang.forth |
| Message-ID | <78001308998436@frunobulax.edu> (permalink) |
| Date | 2011-04-27 22:03 +0200 |
| References | <ip9pl6$a93$1@speranza.aioe.org> |
| Organization | chello.nl |
jsgraham <jsgrahamus@yahoo.com> writes Re: Printing a floating point number > How does one do this in Forth? I have VFX Forth and I pushed 3.14 onto > the stack and tried executing F., for which I got an UNDEFINED WORD error. > I know I'm missing something simple here. Interlocking problems are always difficult. The solution for your first problem is: 3.14e0 ( 3.14 is a double number and the '.' does not mean what you think it means, that's why modern Forth advises to always write 314. ) Because of the second problem, you will get an error even if you guessed '3.14e' needs to be written. The solution to the second problem is loading the Floating-point package *before* trying to use any of its words (here F. and FP number evaluation). (VFX is not alone in failing to include FP in the default startup, SwiftForth has the same annoying behavior.) The VFX manual has ample documentation on how to do this -- although I still not succeeded in creating a .ini file to handle it automatically for me. -marcel
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Printing a floating point number jsgraham <jsgrahamus@yahoo.com> - 2011-04-27 13:09 -0600
Re: Printing a floating point number mhx@iae.nl (Marcel Hendrix) - 2011-04-27 22:03 +0200
Re: Printing a floating point number stephenXXX@mpeforth.com (Stephen Pelc) - 2011-04-27 20:52 +0000
Re: Printing a floating point number jsgraham <jsgrahamus@yahoo.com> - 2011-04-27 15:47 -0600
Re: Printing a floating point number jsgraham <jsgrahamus@yahoo.com> - 2011-04-28 00:49 -0600
Re: Printing a floating point number stephenXXX@mpeforth.com (Stephen Pelc) - 2011-04-28 09:13 +0000
Re: Printing a floating point number mhx@iae.nl (Marcel Hendrix) - 2011-04-28 21:08 +0200
csiph-web