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


Groups > comp.lang.forth > #46607

Double and FP syntax (was: Decimal Point vs. Decimal Comma)

From anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups comp.lang.forth
Subject Double and FP syntax (was: Decimal Point vs. Decimal Comma)
Date 2016-04-09 09:19 +0000
Organization Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID <2016Apr9.111900@mips.complang.tuwien.ac.at> (permalink)
References (7 earlier) <l6idnZ2zi67_9prKnZ2dnUU7-W2dnZ2d@supernews.com> <2016Apr8.103003@mips.complang.tuwien.ac.at> <dt6dnUt7ENie6JrKnZ2dnUU7-bmdnZ2d@supernews.com> <2016Apr8.122641@mips.complang.tuwien.ac.at> <ne9ao1$2gt$1@dont-email.me>

Show all headers | View raw


Bernd Paysan <bernd.paysan@gmx.de> writes:
>Am Fri, 08 Apr 2016 10:26:41 +0000 schrieb Anton Ertl:
>> What is a major problem is the standard double number syntax.  For a
>> newcomer, "1." does something completely unexpected, and pretty
>> puzzling.  And when you explain what it does, the image of an obsolete
>> language will consolidate.  We should switch to a different doubles
>> syntax so that we can (eventually, after a long cooldown time) use "1."
>> for FP.
>
>Actually, your first move (and the narrowing down of the standard to only 
>accept a trailing '.' as indicator of double numbers) makes it rather 
>more than less difficult to switch over, because now, there's no other 
>portable way to indicate doubles.  Having an other way would make it 
>easier to deprecate one way.

We discussed the issue at the 2014 Forth-200x meeting, and my notes
about that say:

|Input: We may want a way to make 100. an FP number in the text
|interpreter.  And a way to allow a more liberal FP number.  Solution:
|use prefixes: *123 and *$-a for doubles and !1 for floats.  At some
|point we deprecate "1." as long, and systems are free to use 1. as FP
|number.  Allow "," in >float and in prefixed floats.  For FP numbers,
|the last separator is the decimal separator.  Action: SP

I don't remember why we wanted another floating-point syntax, but at
the time, among a few options, we selected a * prefix as double
indicator.

You seem to suggest having a "," anywhere in the number as double
indicator.  For some reason nobody (not even you) suggested that at
the time.  Is it a good idea?  Advantages: many Forth systems
understand it already, so it's relatively common practice.
Disadvantages: a) confusion with the word "2,"; b) "," is visually
(and on my (US-layout) keyboard physically) close to ".", making it
harder to see a mistake in that area (remember the story about the "DO
5 K=1.3" mistake, which apparently did not have the expensive
consequences often attributed to it
<http://catless.ncl.ac.uk/Risks/9.54.html#subj1.1>).

>VFX by default for quite some time accepted only ',' as indicator for 
>double numbers, and has '.' for floats.  That's non-standard, and broke 
>e.g. MINOS, so the MINOS harness sets dp-char to '.', and then compiles.  
>That's also bad, because then, other programs written for VFX don't 
>load... but the general idea is in the right direction.

The general idea to go away from "." for doubles and use something
else is in the right direction, yes.  The general idea of DP-CHAR is
bad, as demonstrated above.

>I've added dp-char and fp-char to Gforth, so we again have at least that 
>path open now: Set dp-char to ',', and you can suddenly enter 1. and it 
>is a floating point number.

That's a bad idea.  A standard usage of 1. will suddenly do something
completely different, without warning, because someone somewhere
changed DP-CHAR.

>So a way to proceed would be to standardize dp-char and fp-char, and tell 
>the newbies to put a ',' dp-char ! at the start of their programs and 
>into their .gforthrc (for interactive use).

Over my dead body.

The syntax is something we have to decide as a community.  Chickening
out by providing configuration options (and worse, as global state) to
individual programmers only leads to problems.  System implementors
may decide to inflict such problems on their users by providing such
options in order to support legacy code (but a conversion tool would
be better), but such kludges have no place in the standard.

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2015: http://www.rigwit.co.uk/EuroForth2015/

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


Thread

Decimal Point vs. Decimal Comma rickman <gnuarm@gmail.com> - 2016-04-02 17:49 -0400
  Re: Decimal Point vs. Decimal Comma anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-04-03 06:23 +0000
    Re: Decimal Point vs. Decimal Comma rickman <gnuarm@gmail.com> - 2016-04-03 02:59 -0400
    Re: Decimal Point vs. Decimal Comma Coos Haak <chforth@hccnet.nl> - 2016-04-03 17:33 +0200
      Re: Decimal Point vs. Decimal Comma "Elizabeth D. Rather" <erather@forth.com> - 2016-04-03 21:21 -1000
        Re: Decimal Point vs. Decimal Comma Paul Rubin <no.email@nospam.invalid> - 2016-04-04 01:42 -0700
          Re: Decimal Point vs. Decimal Comma hughaguilar96@gmail.com - 2016-04-04 02:00 -0700
            Re: Decimal Point vs. Decimal Comma Albert van der Horst <albert@spenarnc.xs4all.nl> - 2016-04-04 10:00 +0000
              Re: Decimal Point vs. Decimal Comma hughaguilar96@gmail.com - 2016-04-04 03:04 -0700
              Re: Decimal Point vs. Decimal Comma "Elizabeth D. Rather" <erather@forth.com> - 2016-04-04 11:16 -1000
          Re: Decimal Point vs. Decimal Comma "Elizabeth D. Rather" <erather@forth.com> - 2016-04-03 23:28 -1000
            Re: Decimal Point vs. Decimal Comma Paul Rubin <no.email@nospam.invalid> - 2016-04-04 02:38 -0700
              Re: Decimal Point vs. Decimal Comma "Elizabeth D. Rather" <erather@forth.com> - 2016-04-04 11:09 -1000
            Re: Decimal Point vs. Decimal Comma "HAA" <someone@microsoft.com> - 2016-04-08 00:18 +1000
              Re: Decimal Point vs. Decimal Comma Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-04-08 03:27 -0500
                Re: Decimal Point vs. Decimal Comma anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-04-08 08:30 +0000
                Re: Decimal Point vs. Decimal Comma Ron Aaron <rambamist@gmail.com> - 2016-04-08 12:00 +0300
                Re: Decimal Point vs. Decimal Comma anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-04-08 10:25 +0000
                Re: Decimal Point vs. Decimal Comma Ron Aaron <rambamist@gmail.com> - 2016-04-08 13:34 +0300
                Re: Decimal Point vs. Decimal Comma anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-04-08 11:46 +0000
                Re: Decimal Point vs. Decimal Comma Ron Aaron <rambamist@gmail.com> - 2016-04-08 15:20 +0300
                Re: Decimal Point vs. Decimal Comma Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-04-08 04:08 -0500
                Re: Decimal Point vs. Decimal Comma anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-04-08 10:26 +0000
                Re: Decimal Point vs. Decimal Comma Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-04-08 10:37 -0500
                Re: Decimal Point vs. Decimal Comma anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-04-09 15:28 +0000
                Re: Decimal Point vs. Decimal Comma Paul Rubin <no.email@nospam.invalid> - 2016-04-09 10:17 -0700
                Re: Decimal Point vs. Decimal Comma anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-04-11 14:45 +0000
                Re: Decimal Point vs. Decimal Comma Ron Aaron <rambamist@gmail.com> - 2016-04-12 10:18 +0300
                Re: Decimal Point vs. Decimal Comma hughaguilar96@gmail.com - 2016-04-08 09:05 -0700
                Re: Decimal Point vs. Decimal Comma hughaguilar96@gmail.com - 2016-04-08 10:14 -0700
                Re: Decimal Point vs. Decimal Comma Julian Fondren <julian.fondren@gmail.com> - 2016-04-08 15:51 -0700
                Re: Decimal Point vs. Decimal Comma Julian Fondren <julian.fondren@gmail.com> - 2016-04-08 16:11 -0700
                Re: Decimal Point vs. Decimal Comma "WJ" <w_a_x_man@yahoo.com> - 2016-05-09 01:16 +0000
                Re: Decimal Point vs. Decimal Comma Bernd Paysan <bernd.paysan@gmx.de> - 2016-04-08 22:18 +0000
                Re: Decimal Point vs. Decimal Comma Paul Rubin <no.email@nospam.invalid> - 2016-04-08 20:33 -0700
                Re: Decimal Point vs. Decimal Comma mhx@iae.nl - 2016-04-09 01:20 -0700
                Re: Decimal Point vs. Decimal Comma anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-04-09 11:03 +0000
                Re: Decimal Point vs. Decimal Comma mhx@iae.nl - 2016-04-09 01:29 -0700
                Double and FP syntax (was: Decimal Point vs. Decimal Comma) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-04-09 09:19 +0000
                Re: Double and FP syntax "Elizabeth D. Rather" <erather@forth.com> - 2016-04-09 14:25 -1000
                Re: Double and FP syntax hughaguilar96@gmail.com - 2016-04-10 21:48 -0700
                Re: Double and FP syntax (was: Decimal Point vs. Decimal Comma) stephen@mpeforth.com (Stephen Pelc) - 2016-04-15 10:17 +0000
                Re: Double and FP syntax (was: Decimal Point vs. Decimal Comma) hughaguilar96@gmail.com - 2016-04-17 16:48 -0700
                Re: Double and FP syntax (was: Decimal Point vs. Decimal Comma) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-04-24 16:03 +0000
        Re: Decimal Point vs. Decimal Comma Albert van der Horst <albert@spenarnc.xs4all.nl> - 2016-04-04 09:27 +0000
      Re: Decimal Point vs. Decimal Comma Albert van der Horst <albert@spenarnc.xs4all.nl> - 2016-04-04 08:52 +0000
    Re: Decimal Point vs. Decimal Comma Bernd Paysan <bernd.paysan@gmx.de> - 2016-04-03 23:14 +0000
      Re: Decimal Point vs. Decimal Comma Ron Aaron <rambamist@gmail.com> - 2016-04-04 07:18 +0300
        Re: Decimal Point vs. Decimal Comma Ron Aaron <rambamist@gmail.com> - 2016-04-04 07:48 +0300
  Re: Decimal Point vs. Decimal Comma upsidedown@downunder.com - 2016-04-03 09:45 +0300
  Re: Decimal Point vs. Decimal Comma Nils M Holm <nmh@ananda.local> - 2016-04-03 07:32 +0000
  Re: Decimal Point vs. Decimal Comma George Neuner <gneuner2@comcast.net> - 2016-04-03 05:25 -0400
    Re: Decimal Point vs. Decimal Comma Robert Wessel <robertwessel2@yahoo.com> - 2016-04-03 17:22 -0500
  Re: Decimal Point vs. Decimal Comma Norbert_Paul <norbertpauls_spambin@yahoo.com> - 2016-04-03 14:05 +0200
  Re: Decimal Point vs. Decimal Comma Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2016-04-03 14:18 +0200
    Re: Decimal Point vs. Decimal Comma upsidedown@downunder.com - 2016-04-03 20:24 +0300
      Re: Decimal Point vs. Decimal Comma Niklas Holsti <niklas.holsti@tidorum.invalid> - 2016-04-03 21:05 +0300
        Re: Decimal Point vs. Decimal Comma Albert van der Horst <albert@spenarnc.xs4all.nl> - 2016-04-04 09:00 +0000
      Re: Decimal Point vs. Decimal Comma Ron Aaron <rambamist@gmail.com> - 2016-04-03 21:16 +0300
        Re: Decimal Point vs. Decimal Comma Albert van der Horst <albert@spenarnc.xs4all.nl> - 2016-04-04 09:17 +0000
          Re: Decimal Point vs. Decimal Comma Ron Aaron <rambamist@gmail.com> - 2016-04-04 12:46 +0300
            Re: Decimal Point vs. Decimal Comma anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-04-05 06:02 +0000
      Re: Decimal Point vs. Decimal Comma Bernd Paysan <bernd.paysan@gmx.de> - 2016-04-03 23:21 +0000
        Re: Decimal Point vs. Decimal Comma anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-04-04 07:11 +0000
          Re: Decimal Point vs. Decimal Comma Bernd Paysan <bernd.paysan@gmx.de> - 2016-04-04 21:11 +0000
      Re: Decimal Point vs. Decimal Comma hughaguilar96@gmail.com - 2016-04-03 19:27 -0700
      Re: Decimal Point vs. Decimal Comma Robert Wessel <robertwessel2@yahoo.com> - 2016-04-04 00:13 -0500
        Re: Decimal Point vs. Decimal Comma "Boudewijn Dijkstra" <sp4mtr4p.boudewijn@indes.com> - 2016-04-04 14:06 +0200
      Re: Decimal Point vs. Decimal Comma Nobody <nobody@nowhere.invalid> - 2016-04-05 03:32 +0100
        Re: Decimal Point vs. Decimal Comma hughaguilar96@gmail.com - 2016-04-04 19:52 -0700
        Re: Decimal Point vs. Decimal Comma upsidedown@downunder.com - 2016-04-05 09:56 +0300
          Re: Decimal Point vs. Decimal Comma hughaguilar96@gmail.com - 2016-04-05 00:13 -0700
            Re: Decimal Point vs. Decimal Comma anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-04-05 09:44 +0000
              Re: Decimal Point vs. Decimal Comma Albert van der Horst <albert@spenarnc.xs4all.nl> - 2016-04-05 12:38 +0000
          Re: Decimal Point vs. Decimal Comma Albert van der Horst <albert@spenarnc.xs4all.nl> - 2016-04-05 10:03 +0000
            Re: Decimal Point vs. Decimal Comma Bernd Paysan <bernd.paysan@gmx.de> - 2016-04-05 21:42 +0000
          Re: Decimal Point vs. Decimal Comma George Neuner <gneuner2@comcast.net> - 2016-04-05 11:11 -0400
            Re: Decimal Point vs. Decimal Comma Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-04-05 11:33 -0500
            Re: Decimal Point vs. Decimal Comma hughaguilar96@gmail.com - 2016-04-05 11:58 -0700
            Re: Decimal Point vs. Decimal Comma anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-04-06 12:50 +0000
        Re: Decimal Point vs. Decimal Comma anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-04-05 07:15 +0000
          Re: Decimal Point vs. Decimal Comma hughaguilar96@gmail.com - 2016-04-05 01:12 -0700
          Re: Decimal Point vs. Decimal Comma Bernd Paysan <bernd.paysan@gmx.de> - 2016-04-05 21:50 +0000
            Re: Decimal Point vs. Decimal Comma Dimiter_Popoff <dp@tgi-sci.com> - 2016-04-06 01:18 +0300
              Re: Decimal Point vs. Decimal Comma hughaguilar96@gmail.com - 2016-04-05 23:47 -0700
              Re: Decimal Point vs. Decimal Comma Bernd Paysan <bernd.paysan@gmx.de> - 2016-04-08 23:11 +0000
                Re: Decimal Point vs. Decimal Comma Dimiter_Popoff <dp@tgi-sci.com> - 2016-04-09 03:19 +0300
                Re: Decimal Point vs. Decimal Comma hughaguilar96@gmail.com - 2016-04-08 22:06 -0700
                Re: Decimal Point vs. Decimal Comma mac <acolvin@efunct.com> - 2016-04-11 18:52 +0000
                Re: Decimal Point vs. Decimal Comma Dimiter_Popoff <dp@tgi-sci.com> - 2016-04-11 23:39 +0300
  Re: Decimal Point vs. Decimal Comma endlessboomcapitalism@gmail.com - 2016-05-02 15:29 -0700
    Re: Decimal Point vs. Decimal Comma rickman <gnuarm@gmail.com> - 2016-05-02 22:27 -0400
      Re: Decimal Point vs. Decimal Comma Gerard Sontag <gerardsontag@gmail.com> - 2016-05-03 05:06 -0700
      Re: Decimal Point vs. Decimal Comma Bernd Paysan <bernd.paysan@gmx.de> - 2016-05-06 23:42 +0000
        Re: Decimal Point vs. Decimal Comma rickman <gnuarm@gmail.com> - 2016-05-06 20:37 -0400

csiph-web