Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #48657

Re: RfD: new double syntax

Subject Re: RfD: new double syntax
References <2016Jul1.191836@mips.complang.tuwien.ac.at>
Newsgroups comp.lang.forth
From "Elizabeth D. Rather" <erather@forth.com>
Organization FORTH, Inc.
Date 2016-07-01 09:10 -1000
Message-ID <zb6dncZoGo64XevKnZ2dnUU7-IXNnZ2d@supernews.com> (permalink)

Show all headers | View raw


On 7/1/16 7:18 AM, Anton Ertl wrote:
> Problem
> -------
>
> People coming from other languages expect "1." to be a floating-point
> number.  Standard Forth requires that "1." is interpreted as a
> double-wide integer number.  While some people hail every gratuitious
> difference from other languages as a sign of our independence, this
> makes Forth harder to teach and damages the reputation among
> newcomers: First when they trip across this trap, and further when
> they hear about the reason for this behaviour.
>
>
> Solution
> --------
>
> In the long term, make "1." either non-standard or (even longer-term)
> even make it a floating-point number in the standard.  However, we
> still need a syntax for double-wide integers, and we need to introduce
> this first (and in parallel to the "1." syntax).  So here I propose
> using the syntax "*1" for double-wide integers.
>
> This is just one possible syntax, so if you absolutely cannot live
> with it, I am happy to go for a different one that everybody can live
> with.  But I don't want a bike-shedding discussion, so "I find <other
> syntax> more pleasing" or "How about <other syntax>" is not a good
> argument; a conflict of the proposed syntax with existing practice
> would be a good argument, though.
>
> The further steps would be to make the new syntax standard in the next
> standard (N), and make the "1." syntax obsolescent.  Then
> de-standardize "1."  in standard N+1.  If we then want to standardize
> "1." as FP number, either have one revision cooldown period for this
> syntax and standardize "1." as floating-point value in N+2, or already
> in N+1 without cooldown period.  Yes, it takes long, that's why I want
> to get started.
>
> Proposal
> --------
>
> In "8.3.1 Text interpreter input number conversion", replace
>
> |When the text interpreter processes a number, except a <cnum>, that is
> |immediately followed by a decimal point and is not found as a
> |definition name, the text interpreter shall convert it to a
> |double-cell number.
>
> with
>
> |When the text interpreter processes a number, except a <cnum>, that is
> |immediately preceded by an asterisk or (obsolescent) immediately
> |followed by a decimal point, and is not found as a definition name,
> |the text interpreter shall convert it to a double-cell number.
>
>
> Typical usage
> -------------
>
> *-1
> *$f
> *#-1
>
>
> Reference implementation
> ------------------------
>
> When we get recognizers ...:-)
>
> Test cases
> ----------
>
> T{ *#-1 -- -1 -1 }T
> T{ *1 -- 1 0 }T
> T{ *$ff -- 255 0 }T
>
> Experience
> ----------
>
> None.
>
> - anton
>

One of the cultural differences between Forth and other languages,
dating back to its invention, is that most high-level languages were
developed on large computers and expect floating point numbers. The
early minicomputers for which Forth was designed lacked hardware 
floating point, and Chuck's genius led to operators such as */ and /MOD 
and their relatives. These helped make scaled fixed-point arithmetic a 
fast and accurate computational alternative for complicated 
trigonometry, FFTs, and other computational requirements of motion 
control, image processing, and other early application areas in which 
Forth excelled. Even today, most micro-controllers used in embedded 
applications, still a major market for Forth, lack hardware FP, and few 
embedded applications require it. It would be very uncomfortable to 
burden these programs with notational requirements such as the asterisk 
that are not meaningful to most programmers and users.

The Forth94 TC struggled with this issue, and the trailing decimal point 
was the best compromise they could come up with. I realize it isn't 
ideal, and can present awkward surprises for programmers for whom
floating point is the expected norm. I don't know what would constitute
an ideal solution, but suggest that perhaps a qualifying condition such
as the presence of the Floating Point wordset be used.

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."
==================================================

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

RfD: new double syntax anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-07-01 17:18 +0000
  Re: RfD: new double syntax hughaguilar96@gmail.com - 2016-07-01 11:45 -0700
    Re: RfD: new double syntax rickman <gnuarm@gmail.com> - 2016-07-01 14:46 -0400
  Re: RfD: new double syntax Julian Fondren <julian.fondren@gmail.com> - 2016-07-01 11:47 -0700
    Re: RfD: new double syntax anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-07-02 14:54 +0000
  Re: RfD: new double syntax mhx@iae.nl - 2016-07-01 11:48 -0700
    Re: RfD: new double syntax anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-07-02 14:52 +0000
  Re: RfD: new double syntax "Elizabeth D. Rather" <erather@forth.com> - 2016-07-01 09:10 -1000
    Re: RfD: new double syntax hughaguilar96@gmail.com - 2016-07-01 19:10 -0700
      Re: RfD: new double syntax "WJ" <w_a_x_man@yahoo.com> - 2016-07-02 06:23 +0000
  RfD: new double syntax krishna.myneni@ccreweb.org - 2016-07-01 20:54 -0700
    RfD: new double syntax krishna.myneni@ccreweb.org - 2016-07-01 21:18 -0700
      Re: RfD: new double syntax hughaguilar96@gmail.com - 2016-07-01 22:26 -0700
        Re: RfD: new double syntax "WJ" <w_a_x_man@yahoo.com> - 2016-07-02 22:32 +0000
          Re: RfD: new double syntax rickman <gnuarm@gmail.com> - 2016-07-03 01:16 -0400
            Re: RfD: new double syntax Ron Aaron <rambamist@gmail.com> - 2016-07-03 08:34 +0300
              Re: RfD: new double syntax rickman <gnuarm@gmail.com> - 2016-07-03 03:00 -0400
                Re: RfD: new double syntax Ron Aaron <rambamist@gmail.com> - 2016-07-03 10:20 +0300
                Re: RfD: new double syntax anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-07-03 08:29 +0000
            Re: RfD: new double syntax hughaguilar96@gmail.com - 2016-07-02 23:10 -0700
              Re: RfD: new double syntax Raimond Dragomir <raimond.dragomir@gmail.com> - 2016-07-02 23:20 -0700
                Re: RfD: new double syntax rickman <gnuarm@gmail.com> - 2016-07-03 03:02 -0400
      Re: RfD: new double syntax anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-07-02 14:20 +0000
    Re: RfD: new double syntax anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-07-02 14:11 +0000
  Re: RfD: new double syntax josv@planet.nl - 2016-07-02 00:26 -0700
    Re: RfD: new double syntax "Elizabeth D. Rather" <erather@forth.com> - 2016-07-01 22:22 -1000
      Re: RfD: new double syntax "HAA" <someone@microsoft.com> - 2016-07-02 22:02 +1000
        Re: RfD: new double syntax "Elizabeth D. Rather" <erather@forth.com> - 2016-07-02 11:19 -1000
    Re: RfD: new double syntax anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-07-02 14:02 +0000
  Re: RfD: new double syntax Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-07-02 04:03 -0500
    Re: RfD: new double syntax anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-07-02 13:44 +0000
      Re: RfD: new double syntax hughaguilar96@gmail.com - 2016-07-02 07:38 -0700
        Re: RfD: new double syntax hughaguilar96@gmail.com - 2016-07-02 07:42 -0700
        Re: RfD: new double syntax "WJ" <w_a_x_man@yahoo.com> - 2016-07-02 22:44 +0000
      Re: RfD: new double syntax Cecil Bayona <cbayona@cbayona.com> - 2016-07-02 09:58 -0500
      Re: RfD: new double syntax "Elizabeth D. Rather" <erather@forth.com> - 2016-07-02 11:32 -1000
      Re: RfD: new double syntax "WJ" <w_a_x_man@yahoo.com> - 2016-07-03 00:27 +0000
      Re: RfD: new double syntax hughaguilar96@gmail.com - 2016-07-04 08:05 -0700
      Re: RfD: new double syntax Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-07-04 03:50 -0500
        Re: RfD: new double syntax Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-07-04 03:53 -0500
  Re: RfD: new double syntax anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-07-02 17:32 +0000
    Re: RfD: new double syntax Julian Fondren <julian.fondren@gmail.com> - 2016-07-02 10:52 -0700
      Re: RfD: new double syntax krishna.myneni@ccreweb.org - 2016-07-02 13:03 -0700
      Re: RfD: new double syntax anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-07-03 15:02 +0000
        Re: RfD: new double syntax Julian Fondren <julian.fondren@gmail.com> - 2016-07-03 11:18 -0700
          Re: RfD: new double syntax Coos Haak <chforth@hccnet.nl> - 2016-07-03 21:19 +0200
    Re: RfD: new double syntax Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2016-07-03 11:36 +0100
      Re: RfD: new double syntax Gerard Sontag <gerardsontag@gmail.com> - 2016-07-03 06:58 -0700
        Re: RfD: new double syntax anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-07-03 14:21 +0000
          Re: RfD: new double syntax Gerard Sontag <gerardsontag@gmail.com> - 2016-07-03 07:55 -0700
          Re: RfD: new double syntax hughaguilar96@gmail.com - 2016-07-03 08:08 -0700
            Dealing with multiple recognizers (was: RfD: new double syntax) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-07-03 15:13 +0000
              Re: Dealing with multiple recognizers (was: RfD: new double syntax) hughaguilar96@gmail.com - 2016-07-03 09:57 -0700
          Re: RfD: new double syntax rickman <gnuarm@gmail.com> - 2016-07-05 01:12 -0400
            Re: RfD: new double syntax Gerard Sontag <gerardsontag@gmail.com> - 2016-07-05 07:56 -0700
              Re: RfD: new double syntax rickman <gnuarm@gmail.com> - 2016-07-05 11:18 -0400
        Re: RfD: new double syntax JennyB <jennybrien@googlemail.com> - 2016-07-03 08:15 -0700
        Re: RfD: new double syntax Cecil Bayona <cbayona@cbayona.com> - 2016-07-03 12:42 -0500
          Re: RfD: new double syntax "Elizabeth D. Rather" <erather@forth.com> - 2016-07-03 09:32 -1000
            Re: RfD: new double syntax hughaguilar96@gmail.com - 2016-07-04 07:34 -0700
          Re: RfD: new double syntax Julian Fondren <julian.fondren@gmail.com> - 2016-07-04 10:35 -0700
          Re: RfD: new double syntax Julian Fondren <julian.fondren@gmail.com> - 2016-07-04 09:00 -0700
            Re: RfD: new double syntax hughaguilar96@gmail.com - 2016-07-04 09:51 -0700
          Re: RfD: new double syntax Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-07-04 11:20 -0500
            Re: RfD: new double syntax Howerd <howerdo@yahoo.co.uk> - 2016-07-06 04:08 -0700
              Re: RfD: new double syntax Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-07-06 06:24 -0500
                Re: RfD: new double syntax Alex McDonald <alex@rivadpm.com> - 2016-07-06 12:38 +0100
                Re: RfD: new double syntax Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-07-06 06:46 -0500
                Re: RfD: new double syntax Howerd <howerdo@yahoo.co.uk> - 2016-07-06 13:37 -0700
                Re: RfD: new double syntax Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-07-07 03:28 -0500
                Re: RfD: new double syntax Bernd Paysan <bernd.paysan@gmx.de> - 2016-08-04 23:59 +0000
                Re: RfD: new double syntax Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-08-04 19:26 -0500
                Re: RfD: new double syntax Paul Rubin <no.email@nospam.invalid> - 2016-08-04 17:34 -0700
                Re: RfD: new double syntax franck.bensusan@gmail.com - 2016-08-05 02:57 -0700
                Re: RfD: new double syntax Paul Rubin <no.email@nospam.invalid> - 2016-08-05 13:15 -0700
                Re: RfD: new double syntax franck.bensusan@gmail.com - 2016-08-06 01:56 -0700
                Re: RfD: new double syntax Paul Rubin <no.email@nospam.invalid> - 2016-08-07 17:22 -0700
                Re: RfD: new double syntax franck.bensusan@gmail.com - 2016-08-08 04:56 -0700
                Re: RfD: new double syntax josv@planet.nl - 2016-08-08 08:50 -0700
                Re: RfD: new double syntax franck.bensusan@gmail.com - 2016-08-08 12:26 -0700
                Re: RfD: new double syntax josv@planet.nl - 2016-08-08 15:41 -0700
                Re: RfD: new double syntax mhx@iae.nl - 2016-08-08 23:06 -0700
                Re: RfD: new double syntax josv@planet.nl - 2016-08-09 00:57 -0700
                Re: RfD: new double syntax franck.bensusan@gmail.com - 2016-08-09 03:05 -0700
                Re: RfD: new double syntax hughaguilar96@gmail.com - 2016-08-10 01:46 -0700
                Re: RfD: new double syntax Paul Rubin <no.email@nospam.invalid> - 2016-08-10 19:07 -0700
                Re: RfD: new double syntax franck.bensusan@gmail.com - 2016-08-11 05:24 -0700
                Re: RfD: new double syntax josv@planet.nl - 2016-08-06 04:50 -0700
                Re: RfD: new double syntax Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-08-05 12:01 -0500
          Re: RfD: new double syntax Cecil Bayona <cbayona@cbayona.com> - 2016-07-04 08:51 -0500
          Re: RfD: new double syntax Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-07-04 04:03 -0500
      Re: RfD: new double syntax anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-07-03 14:56 +0000
        Re: RfD: new double syntax Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2016-07-03 22:00 +0100

csiph-web