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


Groups > comp.lang.forth > #9523 > unrolled thread

Adding thousands separators

Started by"Ed" <nospam@invalid.com>
First post2012-02-13 21:24 +1100
Last post2012-03-01 18:52 +0000
Articles 20 on this page of 141 — 26 participants

Back to article view | Back to comp.lang.forth


Contents

  Adding thousands separators "Ed" <nospam@invalid.com> - 2012-02-13 21:24 +1100
    Re: Adding thousands separators Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-02-13 13:05 -0800
      Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-02-16 10:19 +1100
    Re: Adding thousands separators Hans Bezemer <the.beez.speaks@gmail.com> - 2012-02-15 08:48 +0100
      Re: Adding thousands separators Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-02-23 22:46 -0800
        Re: Adding thousands separators "A. K." <akk@nospam.org> - 2012-02-24 08:07 +0100
        Re: Adding thousands separators Hans Bezemer <the.beez.speaks@gmail.com> - 2012-02-24 15:00 +0100
          Re: Adding thousands separators "Elizabeth D. Rather" <erather@forth.com> - 2012-02-24 08:29 -1000
            Re: Adding thousands separators Hans Bezemer <the.beez.speaks@gmail.com> - 2012-02-25 00:11 +0100
          Re: Adding thousands separators Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-02-27 23:28 -0800
            Re: Adding thousands separators Alex McDonald <blog@rivadpm.com> - 2012-02-28 01:37 -0800
              Re: Adding thousands separators Ron Aaron <rambamist@gmail.com> - 2012-02-28 15:06 +0200
            Re: Adding thousands separators Hans Bezemer <the.beez.speaks@gmail.com> - 2012-02-29 09:29 +0100
              Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-02-29 03:00 -0600
                Re: Adding thousands separators The Beez <the.beez.speaks@gmail.com> - 2012-02-29 03:44 -0800
                  Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-02-29 11:19 -0600
              Re: Adding thousands separators hughaguilar96@yahoo.com - 2012-02-29 22:48 -0800
                Re: Adding thousands separators Hans Bezemer <the.beez.speaks@gmail.com> - 2012-03-01 08:38 +0100
                  Re: Adding thousands separators Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-01 00:57 -0800
                    Re: Adding thousands separators Hans Bezemer <the.beez.speaks@gmail.com> - 2012-03-01 18:23 +0100
                    Re: Adding thousands separators John Passaniti <john.passaniti@gmail.com> - 2012-03-01 17:22 -0800
                      Re: Adding thousands separators Paul Rubin <no.email@nospam.invalid> - 2012-03-01 18:00 -0800
                        Re: Adding thousands separators Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-01 22:14 -0800
                          Re: Adding thousands separators John Passaniti <john.passaniti@gmail.com> - 2012-03-02 06:58 -0800
                            Re: Adding thousands separators Paul Rubin <no.email@nospam.invalid> - 2012-03-02 11:07 -0800
                              Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-02 13:13 -0600
                              Re: Adding thousands separators John Passaniti <john.passaniti@gmail.com> - 2012-03-02 11:25 -0800
                                Re: Adding thousands separators Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-03-03 11:00 +0000
                                  Re: Adding thousands separators Paul Rubin <no.email@nospam.invalid> - 2012-03-03 03:17 -0800
                                    Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-03 12:30 +0000
                                      Re: Adding thousands separators John Passaniti <john.passaniti@gmail.com> - 2012-03-03 11:39 -0800
                                      Re: Adding thousands separators Paul Rubin <no.email@nospam.invalid> - 2012-03-06 16:31 -0800
                                    Re: Adding thousands separators mhx@iae.nl (Marcel Hendrix) - 2012-03-03 15:52 +0200
                                      Re: Adding thousands separators Coos Haak <chforth@hccnet.nl> - 2012-03-03 16:23 +0100
                                      Re: Adding thousands separators Paul Rubin <no.email@nospam.invalid> - 2012-03-03 10:19 -0800
                                      Re: Adding thousands separators John Passaniti <john.passaniti@gmail.com> - 2012-03-03 12:35 -0800
                                    Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-03 11:02 -0600
                                      Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-03 17:25 +0000
                                        Re: Adding thousands separators Paul Rubin <no.email@nospam.invalid> - 2012-03-03 10:14 -0800
                                          Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-03 14:14 -0600
                                            Re: Adding thousands separators Paul Rubin <no.email@nospam.invalid> - 2012-03-03 14:52 -0800
                                              Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-04 03:39 -0600
                                          Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-04 15:02 +0000
                                        Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-03 14:11 -0600
                                      Re: Adding thousands separators Bernd Paysan <bernd.paysan@gmx.de> - 2012-03-03 23:49 +0100
                                        Re: Adding thousands separators Paul Rubin <no.email@nospam.invalid> - 2012-03-03 15:50 -0800
                                        Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-04 15:38 +0000
                                          Re: Adding thousands separators Bernd Paysan <bernd.paysan@gmx.de> - 2012-03-04 18:08 +0100
                                            Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-04 11:20 -0600
                                            Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-04 17:45 +0000
                                              Re: Adding thousands separators Bernd Paysan <bernd.paysan@gmx.de> - 2012-03-04 23:50 +0100
                                                Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-05 14:39 +0000
                                          Re: Adding thousands separators Paul Rubin <no.email@nospam.invalid> - 2012-03-06 13:01 -0800
                                            Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-12 16:05 +0000
                                    Re: Adding thousands separators Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-03 15:45 -0800
                                      Re: Adding thousands separators John Passaniti <john.passaniti@gmail.com> - 2012-03-03 17:56 -0800
                                        Re: Adding thousands separators Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-05 15:41 -0800
                                          Re: Adding thousands separators John Passaniti <john.passaniti@gmail.com> - 2012-03-06 11:27 -0800
                                  Re: Adding thousands separators John Passaniti <john.passaniti@gmail.com> - 2012-03-03 11:01 -0800
                        Re: Adding thousands separators John Passaniti <john.passaniti@gmail.com> - 2012-03-02 05:53 -0800
                      Re: Adding thousands separators Bernd Paysan <bernd.paysan@gmx.de> - 2012-03-03 01:49 +0100
        Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-02-29 17:20 +1100
          Re: Adding thousands separators "A. K." <akk@nospam.org> - 2012-02-29 07:51 +0100
          Re: Adding thousands separators hughaguilar96@yahoo.com - 2012-02-29 21:26 -0800
            Re: Adding thousands separators "WJ" <w_a_x_man@yahoo.com> - 2012-03-03 03:45 +0000
            Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-03-04 20:49 +1100
              Re: Adding thousands separators Hans Bezemer <the.beez.speaks@gmail.com> - 2012-03-04 15:16 +0100
                Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-03-06 15:06 +1100
                  Re: Adding thousands separators Hans Bezemer <the.beez.speaks@gmail.com> - 2012-03-06 08:32 +0100
              Re: Adding thousands separators Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-05 15:06 -0800
                Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-03-06 15:03 +1100
                Re: Adding thousands separators hwfwguy@gmail.com - 2012-03-06 20:29 -0800
                  Re: Adding thousands separators Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-06 23:18 -0800
                    Re: Adding thousands separators John Passaniti <john.passaniti@gmail.com> - 2012-03-07 06:07 -0800
                    Re: Adding thousands separators hwfwguy@gmail.com - 2012-03-07 06:36 -0800
                      Re: Adding thousands separators Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-07 16:19 -0800
                        Re: Adding thousands separators Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-03-08 10:51 +0000
    Re: Adding thousands separators Doug Hoffman <glidedog@gmail.com> - 2012-02-15 20:18 -0500
      Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-02-17 12:29 +1100
        Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-02-17 09:42 -0800
          Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-02-20 15:24 +0000
            Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-02-20 20:41 -0800
              Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-02-21 16:46 +0000
                Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-02-21 12:23 -0600
                  Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-02-21 11:32 -0800
                    Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-02-22 12:46 +1100
                      Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-02-22 10:08 +0000
                        Re: Adding thousands separators "Elizabeth D. Rather" <erather@forth.com> - 2012-02-22 08:51 -1000
                          Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-02-22 14:28 -0800
                          Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-02-23 13:13 +0000
                          Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-02-24 14:32 +1100
                            Re: Adding thousands separators "Elizabeth D. Rather" <erather@forth.com> - 2012-02-23 19:53 -1000
                              Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-03-03 12:47 +1100
                                Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-03-02 22:26 -0800
                                  Re: Adding thousands separators Jan Coombs <jan_2011-02@murray-microft.co.uk> - 2012-03-03 14:32 +0000
                                  Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-03-04 21:31 +1100
                                    Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-03-04 10:07 -0800
                                      Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-03-06 15:31 +1100
                                        Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-03-05 22:26 -0800
                                        Re: Adding thousands separators Josh Grams <josh@qualdan.com> - 2012-03-06 12:32 +0000
                            Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-02-24 05:04 -0800
                              Re: Adding thousands separators "Elizabeth D. Rather" <erather@forth.com> - 2012-02-24 08:30 -1000
                      Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-02-22 04:28 -0600
                        Re: Adding thousands separators stephenXXX@mpeforth.com (Stephen Pelc) - 2012-02-22 14:59 +0000
                          Re: Adding thousands separators stephenXXX@mpeforth.com (Stephen Pelc) - 2012-02-22 18:05 +0000
                      Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-02-22 07:49 -0800
                        Re: Adding thousands separators Paul Rubin <no.email@nospam.invalid> - 2012-02-22 12:46 -0800
                          Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-02-22 18:24 -0800
                        Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-02-24 13:23 +1100
                Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-02-21 11:29 -0800
                  Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-02-22 09:56 +0000
                    Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-02-22 07:37 -0800
                      Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-02-22 10:30 -0600
                      Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-02-22 16:24 +0000
                      Re: Adding thousands separators Brad <hwfwguy@gmail.com> - 2012-02-23 07:44 -0800
                        Re: Adding thousands separators Bernd Paysan <bernd.paysan@gmx.de> - 2012-02-23 17:54 +0100
                        Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-02-23 16:51 +0000
                          Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-02-23 11:49 -0600
                            Re: Adding thousands separators Paul Rubin <no.email@nospam.invalid> - 2012-02-23 13:26 -0800
                              Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-02-23 15:58 -0600
                            Re: Adding thousands separators Bernd Paysan <bernd.paysan@gmx.de> - 2012-02-26 02:25 +0100
                              Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-02-26 03:24 -0600
                                Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-02-26 13:40 +0000
                                  Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-02-26 11:06 -0600
                    Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-02-23 15:02 -0800
    Re: Adding thousands separators Doug Hoffman <glidedog@gmail.com> - 2012-02-16 13:21 -0500
    Re: Adding thousands separators Paul Rubin <no.email@nospam.invalid> - 2012-02-16 20:44 -0800
      Re: Adding thousands separators Coos Haak <chforth@hccnet.nl> - 2012-02-17 21:32 +0100
    Re: Adding thousands separators "A. K." <akk@nospam.org> - 2012-02-17 22:41 +0100
      Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-02-17 18:52 -0800
        Re: Adding thousands separators "A. K." <akk@nospam.org> - 2012-02-18 10:39 +0100
          Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-02-18 21:22 +1100
            Re: Adding thousands separators "A. K." <akk@nospam.org> - 2012-02-18 13:12 +0100
              Re: Adding thousands separators "Peter Knaggs" <pjk@bcs.org.uk> - 2012-02-18 16:30 +0000
                Re: Adding thousands separators Jan Coombs <jan_2011-02@murray-microft.co.uk> - 2012-02-18 17:08 +0000
                Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-02-18 14:46 -0800
              Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-03-04 20:47 +1100
    Re: Adding thousands separators Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-02-28 17:03 -0800
    Re: Adding thousands separators "WJ" <w_a_x_man@yahoo.com> - 2012-03-01 18:13 +0000
      Re: Adding thousands separators Alex McDonald <blog@rivadpm.com> - 2012-03-01 12:46 -0800
    Re: Adding thousands separators "WJ" <w_a_x_man@yahoo.com> - 2012-03-01 18:52 +0000

Page 5 of 8 — ← Prev page 1 2 3 4 [5] 6 7 8  Next page →


#9633

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2012-02-20 15:24 +0000
Message-ID<2012Feb20.162456@mips.complang.tuwien.ac.at>
In reply to#9599
BruceMcF <agila61@netscape.net> writes:
>On Feb 16, 8:29=A0pm, "Ed" <nos...@invalid.com> wrote:
>> Doug Hoffman wrote:
>
>> > : numeral? ( char -- f ) [char] 0 - 10 u< ;
>
>> I thought the same too! =A0I called it =A0DIGIT? =A0and added it to my
>> library. The definition is dependent on 2's complement.
>
>Why wouldn't it work in one's complement?

On one hand, with any of the three common representations for signed
nymbers, if the result of the subtraction is negative, it will appear
as a very large positive number when interpreted as unsigned number
(MSB is set).

On the other hand, the hardware may not really support full-width
unsigned numbers on non-2s-complement hardware (I am not an expert on
such hardware, so this is just guesswork), and u may be the same as
+n, and the implementation of U< may be the same as <.  In that case
the code above would produce true for characters <'0'.

The justification for the non-standardness of the code above (allowing
the system to produce such unexpected results) would be that, if the
input is a u, the "-" produced an underflow (non-standard); or if the
input is seen as n, the "-" produced an "n", and you cannot apply U<
on it in a standard program (type error).  This is all not solid,
because it's not clear if the standard defines a consistent type
system.

- 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 2011: http://www.euroforth.org/ef11/

[toc] | [prev] | [next] | [standalone]


#9644

FromBruceMcF <agila61@netscape.net>
Date2012-02-20 20:41 -0800
Message-ID<c42ba797-70a5-4233-9781-d57f5bdbb243@b23g2000yqn.googlegroups.com>
In reply to#9633
On Feb 20, 10:24 am, an...@mips.complang.tuwien.ac.at (Anton Ertl)
wrote:
> On the other hand, the hardware may not really support full-width
> unsigned numbers on non-2s-complement hardware (I am not an expert on
> such hardware, so this is just guesswork), and u may be the same as
> +n, and the implementation of U< may be the same as <.  In that case
> the code above would produce true for characters <'0'.

Yeah, I can see that for signed magnitude, that:
   [+]$2F - [+]$30 = [-]$1

... might have domain problems for U< it's the one's complement that
puzzled me. Other than the result as an unsigned being one smaller, it
looks as kosher in one's complement as in two's complement to me.

[toc] | [prev] | [next] | [standalone]


#9651

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2012-02-21 16:46 +0000
Message-ID<2012Feb21.174615@mips.complang.tuwien.ac.at>
In reply to#9644
BruceMcF <agila61@netscape.net> writes:
>Yeah, I can see that for signed magnitude, that:
>   [+]$2F - [+]$30 =3D [-]$1
>
>... might have domain problems for U< it's the one's complement that
>puzzled me.

If the sign bit is the MSB, and the hardware has a comparison
operation that considers a number with set MSB as a large number
(i.e., an "unsigned compare"), then a Forth system will use that
unsigned compare for U< and 9 -1 U< will be true whether -1 is
represented in 2s-complement, 1's complement, or sign-magnitude.

However, if the hardware does not have such an unsigned comparison,
only a signed comparison, and the Forth system implements U< to just
use this signed comparison without provision for dealing with negative
numbers, then 9 -1 U< will be false whether -1 is represented in
2s-complement, 1's complement, or sign-magnitude.

- 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 2011: http://www.euroforth.org/ef11/

[toc] | [prev] | [next] | [standalone]


#9652

FromAndrew Haley <andrew29@littlepinkcloud.invalid>
Date2012-02-21 12:23 -0600
Message-ID<kPKdnRbuEfWafN7SnZ2dnUVZ_vednZ2d@supernews.com>
In reply to#9651
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
> BruceMcF <agila61@netscape.net> writes:
>>Yeah, I can see that for signed magnitude, that:
>>   [+]$2F - [+]$30 =3D [-]$1
>>
>>... might have domain problems for U< it's the one's complement that
>>puzzled me.
> 
> If the sign bit is the MSB, and the hardware has a comparison
> operation that considers a number with set MSB as a large number
> (i.e., an "unsigned compare"), then a Forth system will use that
> unsigned compare for U< and 9 -1 U< will be true whether -1 is
> represented in 2s-complement, 1's complement, or sign-magnitude.
> 
> However, if the hardware does not have such an unsigned comparison,
> only a signed comparison, and the Forth system implements U< to just
> use this signed comparison without provision for dealing with negative
> numbers, then 9 -1 U< will be false whether -1 is represented in
> 2s-complement, 1's complement, or sign-magnitude.

Or, just use WITHIN !  :-)

Andrew.

[toc] | [prev] | [next] | [standalone]


#9654

FromBruceMcF <agila61@netscape.net>
Date2012-02-21 11:32 -0800
Message-ID<1c0e70b2-978b-4c61-9bc8-848883b587c0@i18g2000yqf.googlegroups.com>
In reply to#9652
On Feb 21, 1:23 pm, Andrew Haley <andre...@littlepinkcloud.invalid>
wrote:
> Anton Ertl <an...@mips.complang.tuwien.ac.at> wrote:
> > BruceMcF <agil...@netscape.net> writes:
> >>Yeah, I can see that for signed magnitude, that:
> >>   [+]$2F - [+]$30 =3D [-]$1
>
> >>... might have domain problems for U< it's the one's complement that
> >>puzzled me.
>
> > If the sign bit is the MSB, and the hardware has a comparison
> > operation that considers a number with set MSB as a large number
> > (i.e., an "unsigned compare"), then a Forth system will use that
> > unsigned compare for U< and 9 -1 U< will be true whether -1 is
> > represented in 2s-complement, 1's complement, or sign-magnitude.
>
> > However, if the hardware does not have such an unsigned comparison,
> > only a signed comparison, and the Forth system implements U< to just
> > use this signed comparison without provision for dealing with negative
> > numbers, then 9 -1 U< will be false whether -1 is represented in
> > 2s-complement, 1's complement, or sign-magnitude.
>
> Or, just use WITHIN !  :-)

You could, indeed, conditionally compile:

[ -1 0 U< ] [IF] ... [ELSE] ... [THEN]

... but just using WITHIN is simpler, since then whether the U< works
correctly outside its standard domain is not an issue.

[toc] | [prev] | [next] | [standalone]


#9657

From"Ed" <nospam@invalid.com>
Date2012-02-22 12:46 +1100
Message-ID<ji1h8d$qe1$1@news-01.bur.connect.com.au>
In reply to#9654
BruceMcF wrote:
>
> ... but just using WITHIN is simpler, since then whether the U< works
> correctly outside its standard domain is not an issue.

Using WITHIN may be "simpler" but it has its costs.  See below.

I make no apology for comparison technique I used.  It's cheap,
easy, and works.  I baulk at the notion of having to support
non 2's-complement machines at the cost of efficiency or
complicated compile-time options.  Forth is not a strictly 'typed'
language.  If we can exploit 2's complement machines to our
benefit, it would be amiss of us not to use it.

--

 VFX Forth for Windows IA32
 c MicroProcessor Engineering Ltd, 1998-2007

 Version: 4.02 [build 2438]
 Build date: 14 August 2007

 Free dictionary = 7680282 bytes [7500kb]


: test1  [char] 0 [char] 9 1+ within ;  ok
: test2  [char] 0 - 10 u< ;  ok
  ok

see test1
TEST1
( 004AAF10    8D6DF8 )                LEA       EBP, [EBP+-08]
( 004AAF13    C7450030000000 )        MOV       DWord Ptr [EBP], 00000030
( 004AAF1A    895D04 )                MOV       [EBP+04], EBX
( 004AAF1D    BB3A000000 )            MOV       EBX, 0000003A
( 004AAF22    E88DDFF5FF )            CALL      00408EB4        WITHIN
( 004AAF27    C3 )                    NEXT,
( 24 bytes, 6 instructions )
 ok

see within
WITHIN
( 00408EB4    8B4500 )                MOV       EAX, [EBP]
( 00408EB7    8B4D04 )                MOV       ECX, [EBP+04]
( 00408EBA    2BD8 )                  SUB       EBX, EAX
( 00408EBC    2BC8 )                  SUB       ECX, EAX
( 00408EBE    8D6D08 )                LEA       EBP, [EBP+08]
( 00408EC1    2BCB )                  SUB       ECX, EBX
( 00408EC3    1BDB )                  SBB       EBX, EBX
( 00408EC5    C3 )                    NEXT,
( 18 bytes, 8 instructions )
 ok

see test2
TEST2
( 004AAF50    83C3D0 )                ADD       EBX, -30
( 004AAF53    83FB0A )                CMP       EBX, 0A
( 004AAF56    0F92C3 )                SETB/NAE BL
( 004AAF59    F6DB )                  NEG       BL
( 004AAF5B    0FBEDB )                MOVSX     EBX, BL
( 004AAF5E    C3 )                    NEXT,
( 15 bytes, 6 instructions )
 ok


[toc] | [prev] | [next] | [standalone]


#9659

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2012-02-22 10:08 +0000
Message-ID<2012Feb22.110858@mips.complang.tuwien.ac.at>
In reply to#9657
"Ed" <nospam@invalid.com> writes:
>I make no apology for comparison technique I used.  It's cheap,
>easy, and works.  I baulk at the notion of having to support
>non 2's-complement machines at the cost of efficiency or
>complicated compile-time options.

Yes, I think we should standardize 2s-complement machines and the
various properties that they have.  If anyone ever does a Forth for a
non-2s-complement machine, it would have some environmental
restrictions.

> Version: 4.02 [build 2438]
> Build date: 14 August 2007

That's pretty old, but 4.40 from December 2009 gives the same results.

>: test1  [char] 0 [char] 9 1+ within ;  ok
>: test2  [char] 0 - 10 u< ;  ok
>  ok
>
>see test1
>TEST1
>( 004AAF10    8D6DF8 )                LEA       EBP, [EBP+-08]
>( 004AAF13    C7450030000000 )        MOV       DWord Ptr [EBP], 00000030
>( 004AAF1A    895D04 )                MOV       [EBP+04], EBX
>( 004AAF1D    BB3A000000 )            MOV       EBX, 0000003A
>( 004AAF22    E88DDFF5FF )            CALL      00408EB4        WITHIN
>( 004AAF27    C3 )                    NEXT,
>( 24 bytes, 6 instructions )
> ok
>
>see within
>WITHIN
>( 00408EB4    8B4500 )                MOV       EAX, [EBP]
>( 00408EB7    8B4D04 )                MOV       ECX, [EBP+04]
>( 00408EBA    2BD8 )                  SUB       EBX, EAX
>( 00408EBC    2BC8 )                  SUB       ECX, EAX
>( 00408EBE    8D6D08 )                LEA       EBP, [EBP+08]
>( 00408EC1    2BCB )                  SUB       ECX, EBX
>( 00408EC3    1BDB )                  SBB       EBX, EBX
>( 00408EC5    C3 )                    NEXT,
>( 18 bytes, 8 instructions )
> ok

Interestingly, it does much better if WITHIN is defined in Forth:

: within over - >r - r> u< ; \ depends on the same properties as test2
: test1  [char] 0 [char] 9 1+ within ;
: test2  [char] 0 - 10 u< ;
see test1
see test2

TEST1 
( 080B9D40    6A0A )                  PUSH      0A
( 080B9D42    83C3D0 )                ADD       EBX, -30
( 080B9D45    5A )                    POP       EDX
( 080B9D46    3BDA )                  CMP       EBX, EDX
( 080B9D48    0F92C3 )                SETB/NAE BL
( 080B9D4B    F6DB )                  NEG       BL
( 080B9D4D    0FBEDB )                MOVSX     EBX, BL
( 080B9D50    C3 )                    NEXT,
( 17 bytes, 8 instructions )

TEST2 
( 080B9D70    83C3D0 )                ADD       EBX, -30
( 080B9D73    83FB0A )                CMP       EBX, 0A
( 080B9D76    0F92C3 )                SETB/NAE BL
( 080B9D79    F6DB )                  NEG       BL
( 080B9D7B    0FBEDB )                MOVSX     EBX, BL
( 080B9D7E    C3 )                    NEXT,
( 15 bytes, 6 instructions )

VFX is (was?) not perfect at eliminating the return stack traffic, but
otherwise it performs the same optimizations as the human who coded
TEST2.  I wonder why the builtin WITHIN is worse.

- 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 2011: http://www.euroforth.org/ef11/

[toc] | [prev] | [next] | [standalone]


#9669

From"Elizabeth D. Rather" <erather@forth.com>
Date2012-02-22 08:51 -1000
Message-ID<yqGdnRkT_eGHpNjSnZ2dnUVZ_hqdnZ2d@supernews.com>
In reply to#9659
On 2/22/12 12:08 AM, Anton Ertl wrote:
> "Ed"<nospam@invalid.com>  writes:
>> I make no apology for comparison technique I used.  It's cheap,
>> easy, and works.  I baulk at the notion of having to support
>> non 2's-complement machines at the cost of efficiency or
>> complicated compile-time options.
>
> Yes, I think we should standardize 2s-complement machines and the
> various properties that they have.  If anyone ever does a Forth for a
> non-2s-complement machine, it would have some environmental
> restrictions.

Well, that's one approach, but it's pretty easy to document your code as 
dependent on 2's complement arithmetic and not worry about it further. 
No one *has* to support non-2's complement arithmetic!

I truly don't understand why everyone is so allergic to declaring 
dependencies, as though it were a mark of shame.

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

[toc] | [prev] | [next] | [standalone]


#9673

FromBruceMcF <agila61@netscape.net>
Date2012-02-22 14:28 -0800
Message-ID<e1d5edbf-6be8-434b-bca9-d14d5d125ffb@f4g2000yqh.googlegroups.com>
In reply to#9669
On Feb 22, 1:51 pm, "Elizabeth D. Rather" <erat...@forth.com> wrote:
> Well, that's one approach, but it's pretty easy to document your code as
> dependent on 2's complement arithmetic and not worry about it further.
> No one *has* to support non-2's complement arithmetic!

It's not dependency on two's complement arithmetic in particular, its
a dependency on U< treating all positive integers as less than all
negative integers.

That's *true* for both one's complement and two's complement encodings
of negatives, since for each +0 to max positive then overflows to
largest magnitude negative through to smallest magnitude negative. Now
in 2's complement the smallest magnitude negative is -1 and in 1's
complement its -0, but the dependency is satisfied by either
complementary encoding of negative integers.

As far as Anton's worry that 1's complement hardware will not reflect
that aspect of the 1's complement encoding and that will be reflected
in U< possibly not satisfying the dependency ~ well, equally well so
could some exotic 2's complement FPGA processor core.

As far as it actually ever existing, I'd expect its more likely to
exist in some 2's complement hardware somewhere, because its such an
unlikely occurrence, and when the probability of an individual
occurrence of a mutation is very low, you need a much larger
reproducing population to expect to ever see an instance.

[toc] | [prev] | [next] | [standalone]


#9679

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2012-02-23 13:13 +0000
Message-ID<2012Feb23.141344@mips.complang.tuwien.ac.at>
In reply to#9669
"Elizabeth D. Rather" <erather@forth.com> writes:
>On 2/22/12 12:08 AM, Anton Ertl wrote:
>> Yes, I think we should standardize 2s-complement machines and the
>> various properties that they have.  If anyone ever does a Forth for a
>> non-2s-complement machine, it would have some environmental
>> restrictions.
>
>Well, that's one approach, but it's pretty easy to document your code as 
>dependent on 2's complement arithmetic and not worry about it further. 

Well, that code is not dependent on 2s-complement arithmetic, but on
some properties that Forth systems on 2s-complement machines tend to
have, but others maybe not (and these properties are not guaranteed on
2s-complement machines, either).

>I truly don't understand why everyone is so allergic to declaring 
>dependencies, as though it were a mark of shame.

Well, Ed actually did declare a dependency, it just was not the right
dependency.  That's one reason for standardizing instead of just
declaring: Standards tend to be more precise than individual
declarations.

Also the standardization question is not about allergies, but about
common practice.  And Forth systems on 2s-complement machines, with
properties such as the one that Ed depended on, but did not declare,
are not just common, but universal practice.  And Forth programs
relying on such properties are pretty common, too.

In particular, for such universal and widely-used properties, why
should it be a good idea to burden the programmers with the
requirement to declare dependencies on them, in many programs, instead
of just documenting them just once 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 2011: http://www.euroforth.org/ef11/

[toc] | [prev] | [next] | [standalone]


#9692

From"Ed" <nospam@invalid.com>
Date2012-02-24 14:32 +1100
Message-ID<ji7078$ine$1@news-01.bur.connect.com.au>
In reply to#9669
Elizabeth D. Rather wrote:
> ...
> I truly don't understand why everyone is so allergic to declaring
> dependencies, as though it were a mark of shame.

It is a mark of shame.

ANS-Forth is God (and Bruce his prophet).  Portability is
the holy grail of ANS-Forth.  The more portable our code,
the closer we must be to God.  Anything less indicates
failure on our part.

What is not portable is sin.  Sinning can be corrected with
punishment and flagellation on c.l.f.  Bruce whips us until
we are pure and clean - worthy acolytes of the great God
ANS-Forth.

:)


[toc] | [prev] | [next] | [standalone]


#9695

From"Elizabeth D. Rather" <erather@forth.com>
Date2012-02-23 19:53 -1000
Message-ID<GJidnSriL_BIuNrSnZ2dnUVZ_s-dnZ2d@supernews.com>
In reply to#9692
On 2/23/12 5:32 PM, Ed wrote:
> Elizabeth D. Rather wrote:
>> ...
>> I truly don't understand why everyone is so allergic to declaring
>> dependencies, as though it were a mark of shame.
>
> It is a mark of shame.
>
> ANS-Forth is God (and Bruce his prophet).  Portability is
> the holy grail of ANS-Forth.  The more portable our code,
> the closer we must be to God.  Anything less indicates
> failure on our part.
>
> What is not portable is sin.  Sinning can be corrected with
> punishment and flagellation on c.l.f.  Bruce whips us until
> we are pure and clean - worthy acolytes of the great God
> ANS-Forth.
>
> :)

Ok, have your joke, but I think Bruce is as practical as the next person 
when it comes to making a realistic assessment of what practical 
portability is needed.

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

[toc] | [prev] | [next] | [standalone]


#9789

From"Ed" <nospam@invalid.com>
Date2012-03-03 12:47 +1100
Message-ID<jirt29$1f1$1@news-01.bur.connect.com.au>
In reply to#9695
Elizabeth D. Rather wrote:
> On 2/23/12 5:32 PM, Ed wrote:
> > Elizabeth D. Rather wrote:
> >> ...
> >> I truly don't understand why everyone is so allergic to declaring
> >> dependencies, as though it were a mark of shame.
> >
> > It is a mark of shame.
> >
> > ANS-Forth is God (and Bruce his prophet).  Portability is
> > the holy grail of ANS-Forth.  The more portable our code,
> > the closer we must be to God.  Anything less indicates
> > failure on our part.
> >
> > What is not portable is sin.  Sinning can be corrected with
> > punishment and flagellation on c.l.f.  Bruce whips us until
> > we are pure and clean - worthy acolytes of the great God
> > ANS-Forth.
> >
> > :)
>
> Ok, have your joke, but I think Bruce is as practical as the next person
> when it comes to making a realistic assessment of what practical
> portability is needed.

I know of no one's complement machines that I realistically
need to support.


[toc] | [prev] | [next] | [standalone]


#9793

FromBruceMcF <agila61@netscape.net>
Date2012-03-02 22:26 -0800
Message-ID<143b5200-e8a6-41f2-bb32-2223e576b0be@y17g2000yqg.googlegroups.com>
In reply to#9789
On Mar 2, 8:47 pm, "Ed" <nos...@invalid.com> wrote:
> I know of no one's complement machines that I realistically
> need to support.

Not just one's complement machines ~ crippled one's complement
machines without a carry wraparound flag.

Given the ability to implement microprocessors on FPGA cores, someone
could very well implement a processor with crippled 2's complement
arithmetic that makes supporting the normal U< behavior expensive.

Now, specifying the common 1's complement and 2's complement
*treatment* of:
   ... ( +n1 -n2 ) U< ...

... as the standard behavior of U< would impose extra work on such
crippled 2's complement hardware or crippled 1's complement hardware.
And probably on any signed magnitude hardware. But:
    (X work / implementation)*(0 implementations) = 0 extra work

... so I don't see anything wrong with it.

[toc] | [prev] | [next] | [standalone]


#9804

FromJan Coombs <jan_2011-02@murray-microft.co.uk>
Date2012-03-03 14:32 +0000
Message-ID<JYCdnW4QVszzts_SnZ2dnUVZ8qudnZ2d@brightview.co.uk>
In reply to#9793
On 03/03/12 06:26, BruceMcF wrote:
> On Mar 2, 8:47 pm, "Ed"<nos...@invalid.com>  wrote:
>> I know of no one's complement machines that I realistically
>> need to support.
>
> Not just one's complement machines ~ crippled one's complement
> machines without a carry wraparound flag.
>
> Given the ability to implement microprocessors on FPGA cores, someone
> could very well implement a processor with crippled 2's complement
> arithmetic that makes supporting the normal U<  behavior expensive.

Work in hand.  The processor supports only a signed integer of 
unconstrained size, so there is no wrap from maxint to minint or back.

Should anyone wish to experiment with more conventional stack 
hardware, targeting FPGAs, I have both j1 and b16 just working in a 
simple open and free simulation environment.

Jan Coombs.

[toc] | [prev] | [next] | [standalone]


#9832

From"Ed" <nospam@invalid.com>
Date2012-03-04 21:31 +1100
Message-ID<jivg50$o4o$1@news-01.bur.connect.com.au>
In reply to#9793
BruceMcF wrote:
> On Mar 2, 8:47 pm, "Ed" <nos...@invalid.com> wrote:
> > I know of no one's complement machines that I realistically
> > need to support.
>
> Not just one's complement machines ~ crippled one's complement
> machines without a carry wraparound flag.
>
> Given the ability to implement microprocessors on FPGA cores, someone
> could very well implement a processor with crippled 2's complement
> arithmetic that makes supporting the normal U< behavior expensive.
>
> Now, specifying the common 1's complement and 2's complement
> *treatment* of:
>    ... ( +n1 -n2 ) U< ...
>
> ... as the standard behavior of U< would impose extra work on such
> crippled 2's complement hardware or crippled 1's complement hardware.
> And probably on any signed magnitude hardware. But:
>     (X work / implementation)*(0 implementations) = 0 extra work
>
> ... so I don't see anything wrong with it.

I see nothing there which I practically need to support.

Elizabeth believes you're realistic.  Tell her about it.


[toc] | [prev] | [next] | [standalone]


#9847

FromBruceMcF <agila61@netscape.net>
Date2012-03-04 10:07 -0800
Message-ID<524567cc-4a1c-466b-bf27-0bcc4d879432@p13g2000yqd.googlegroups.com>
In reply to#9832
On Mar 4, 5:31 am, "Ed" <nos...@invalid.com> wrote:
> I see nothing there which I practically need to support.

Who's asking you to?

[toc] | [prev] | [next] | [standalone]


#9875

From"Ed" <nospam@invalid.com>
Date2012-03-06 15:31 +1100
Message-ID<jj43oo$43v$1@news-01.bur.connect.com.au>
In reply to#9847
BruceMcF wrote:
> On Mar 4, 5:31 am, "Ed" <nos...@invalid.com> wrote:
> > I see nothing there which I practically need to support.
>
> Who's asking you to?

Aren't you?  If not, then what are you doing stalking my posts
for the best part of a year looking for anything you can to nit-pick.


[toc] | [prev] | [next] | [standalone]


#9876

FromBruceMcF <agila61@netscape.net>
Date2012-03-05 22:26 -0800
Message-ID<ead4a7b1-6b7d-4469-be30-285570591fa2@w5g2000yqi.googlegroups.com>
In reply to#9875
On Mar 5, 11:31 pm, "Ed" <nos...@invalid.com> wrote:
> BruceMcF wrote:
>> On Mar 4, 5:31 am, "Ed" <nos...@invalid.com> wrote:
>>> I see nothing there which I practically need to support.

>> Who's asking you to?

> Aren't you?  If not, then what are you doing stalking my posts
> for the best part of a year looking for anything you can to nit-pick.

My question was regarding the thread at hand, where I never criticized
your code nor suggested that you should change your code.

I've looked back, and only person who suggested a modification was
Andrew. I've questioned or disputed Doug Hoffman, Anton Ertl and
Elizabeth Rather on where the dependency on 2's complement arithmetic
rests, until Jan Coombs established that it can't be a dependence on
2's complement arithmetic by posing a 2's complement system in which
unsigned values are always positive (which then implies that U< may
well be an alias for < ~ which crosses the dependency).

Getting the dependency stated correctly is the *opposite* of asking
you to support Jan Coombs planned hardware (which AFAIU might be
outside of the ANS system anyway for other reasons), or the signed
magnitude microcontrollers used in the self-adjusting unicorn saddles.
Its *saying* that you are supporting X, so if someone's system does
not fall inside X, they'll have to sort that out if they want to use
your code.

[toc] | [prev] | [next] | [standalone]


#9879

FromJosh Grams <josh@qualdan.com>
Date2012-03-06 12:32 +0000
Message-ID<4f5603e2$0$31604$882e7ee2@usenet-news.net>
In reply to#9875
Ed wrote: <jj43oo$43v$1@news-01.bur.connect.com.au>
> BruceMcF wrote:
>> On Mar 4, 5:31 am, "Ed" <nos...@invalid.com> wrote:
>> > I see nothing there which I practically need to support.
>>
>> Who's asking you to?
>
> Aren't you?  If not, then what are you doing stalking my posts
> for the best part of a year looking for anything you can to nit-pick.

What makes you say that Bruce is stalking your posts?  I would have said
he was pretty much an equal-opportunity nit-picker...

--Josh

[toc] | [prev] | [next] | [standalone]


Page 5 of 8 — ← Prev page 1 2 3 4 [5] 6 7 8  Next page →

Back to top | Article view | comp.lang.forth


csiph-web