embedded systems developers tools, cross compilers
  Home  |   SwiftX Archive  |   SwiftForth Archive  |

Re: Why is 4+ legal?

From: Elizabeth D. Rather <erather_at_forth.com>
Date: Fri, 01 Jun 2001 10:59:58 -0700

This feature is documented in the SwiftX Reference Manual (SwiftX.pdf)
Section 6.1. It is not a feature of ANS Forth (in which only a decimal
point at the right end of the number makes it double, and no other
punctuation is allowed), but has been a feature of FORTH, Inc. products
(e.g., polyFORTH, chipFORTH, SwiftForth, SwiftX) since the 1970's. It
allows straightforward numeric input in a variety of "natural" formats,
such as 8/03/40, 229-48-0332, 5:30:00, etc. In entering angular values, in
particular, a leading + is important, although I suppose you could make the
argument that + should only be accepted at the left edge of the number.

Cheers,
Elizabeth

At 10:02 AM 6/1/01 -0700, David Graham wrote:

>Oh, I did not know +/- postscripts signify a double number. I had never
>seen that documented, nor did I understand that from Leon's answer. Now
>that I know about it, I will have frequent use for it. I wonder what else I
>am missing. What references document standard Forth? None of my Forth books
>mention this particular definition, including the SwiftX documents, as far
>as I can tell.
>
>Thanks,
>David Graham
>
> > -----Original Message-----
> > From: swiftx-bounce_at_forth.com [mailto:swiftx-bounce_at_forth.com]On Behalf
> > Of Appert, Kevin
> > Sent: Friday, June 01, 2001 9:14 AM
> > To: 'swiftx_at_forth.com'
> > Subject: [swiftx] Re: Why is 4+ legal?
> >
> >
> >
> > To deal with the ED class of problem on one project we had a
> > rule that
> > numbers had to start with 0, like 0ED and NOTHING ELSE could
> > start with a 0.
> > The first few integers 00, 01, 02, etc. were defined and the 0, 1 and 2
> > definitions removed. This caused problems for one of my
> > colleagues who was
> > just learning C and carried the habit over where he learned what C thought
> > 0321 meant the hard way. This was a system which only had HEX and DECIMAL
> > and no $ flag for hex numbers.
> > You can't always tell the customer what he's doing wrong or
> > change the
> > standard to avoid all awkwardness. ED frequently starts the editor and I
> > guess $ED could be some sort of editor string. Perhaps all hex numbers
> > should start with $ and NOTHING ELSE should.
> > So 1+ is an increment and 4+ is a double number. 2+ is a coin toss
> > which caught me a while back when I didn't see it in some great code Leon
> > wrote. Maybe we should take + off the list of double number flags. Has
> > anyone ever used it or seen it used?
> >
> > > ----------
> > > From: David Graham[SMTP:dgraham_at_GrahamAutomationInc.com]
> > > Reply To: swiftx_at_forth.com
> > > Sent: Wednesday, May 30, 2001 12:25 PM
> > > To: swiftx_at_forth.com
> > > Subject: [swiftx] Re: Why is 4+ legal?
> > >
> > >
> > > I wanted to report a peculiar feature of SwiftX 3.0, HC12
> > > version. The compiler accepts n+ or n-, where n is any numeric
> > > digit, as a legal definition, and leaves n 0 in the stack. I
> > just caught
> > > by
> > > this when I mistyped 4 + as 4+.
> > >
> > > Regards,
> > > David Graham
> > > Graham Automation, Inc.
> > > PO Box 623
> > > McMinnville, OR 97128
> > > (503) 434-8636 Fax (503) 212-0181
> > > dgraham_at_GrahamAutomationInc.com
> > >
> > >
> > > > Hi David,
> > > >
> > > > That's an artifact of the standard Forth double number conversion.
> > > Always
> > > > be very careful with anything that might accidentally be
> > converted to a
> > > > number! One of our competitor's systems defines two words, ED
> > > > and $ED which
> > > > conflict with hex numbers of the same value. Drives me crazy.
> > > >
> > > > Leon
>
>----------------------------------------------------------------------
>swiftx_at_forth.com The SwiftX programming discussion email list
>To unsubscribe, send subject "unsubscribe swiftx" to listar_at_forth.com
>For help with listar commands, send subject "help" to listar_at_forth.com
>Archives are located at http://www.forth.com/swiftx -- check them out!

================================================
Elizabeth D. Rather (US & Canada) 800-55-FORTH
FORTH Inc. +1 310-491-3356
5155 W. Rosecrans Ave. #1018 Fax: +1 310-978-9454
Hawthorne, CA 90250
http://www.forth.com

"Forth-based products and Services for real-time
applications since 1973."
================================================

----------------------------------------------------------------------
swiftx_at_forth.com The SwiftX programming discussion email list
To unsubscribe, send subject "unsubscribe swiftx" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/swiftx -- check them out!
Received on Fri Jun 01 2001 - 10:58:16 PDT

This archive was generated by hypermail 2.2.0 : Wed Jan 07 2009 - 03:04:23 PST