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


Groups > comp.lang.forth > #135098

Re: Forth for a balanced ternary machine

Date 2026-05-26 15:53 +1000
Subject Re: Forth for a balanced ternary machine
Newsgroups comp.lang.forth
References <10v1h24$1adtp$1@dont-email.me> <2026May25.201036@mips.complang.tuwien.ac.at>
From dxf <dxforth@gmail.com>
Message-ID <6a153548$1@news.ausics.net> (permalink)
Organization Ausics - https://newsgroups.ausics.net

Show all headers | View raw


On 26/05/2026 4:10 am, Anton Ertl wrote:
> Matthias Koch <m.cook@gmx.net> writes:
> ... 
> |In balanced ternary, a right shift is exactly the same as symmetric
> |division by powers of three, unlike binary in which right-shifting
> |negative two-complement numbers to divide by powers of two gives
> |rounding artifacts.
> 
> Floored division is not any more a rounding artifact than symmetric
> division is.  Whether to use floored or symmetric division depends on
> the application.  That's why we have FM/MOD and SM/REM in the
> standard.  The Forth-83 committee was so strongly in favour of floored
> that they broke compatibility with Forth-79 because of that.
> 
> Gforth since 0.7 implements / and other division words where Forth-94
> allows the system to choose as floored division words.  This means
> that in Gforth, "2 /" is equivalent to 2/ (which is defined as a shift
> right by 1 bit):
> 
> -3 2 / . \ prints -2
> -3 2/ .  \ prints -2

Which is all very nice until beginners ask how that makes any sense ;-)

ANS at least tells you 2* 2/ are bit-shifters with historic, albeit misleading,
names.

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


Thread

Forth for a balanced ternary machine Matthias Koch <m.cook@gmx.net> - 2026-05-25 14:58 +0200
  Re: Forth for a balanced ternary machine anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-05-25 18:10 +0000
    Re: Forth for a balanced ternary machine dxf <dxforth@gmail.com> - 2026-05-26 15:53 +1000
      Re: Forth for a balanced ternary machine anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-05-26 07:46 +0000
        Re: Forth for a balanced ternary machine dxf <dxforth@gmail.com> - 2026-05-27 00:52 +1000
          Teaching Scenarios [Re: Forth for a balanced ternary machine] Buzz McCool <buzz_mccool@yahoo.com> - 2026-05-26 08:52 -0700
            Re: Teaching Scenarios [Re: Forth for a balanced ternary machine] dxf <dxforth@gmail.com> - 2026-05-28 21:03 +1000
            Re: Teaching Scenarios [Re: Forth for a balanced ternary machine] anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-05-30 20:16 +0000
              Re: Teaching Scenarios [Re: Forth for a balanced ternary machine] minforth <minforth@gmx.net> - 2026-05-31 11:02 +0200
                Re: Teaching Scenarios [Re: Forth for a balanced ternary machine] anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-05-31 14:13 +0000
          Division (was: Forth for a balanced ternary machine) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-05-30 18:23 +0000
            Re: Division dxf <dxforth@gmail.com> - 2026-05-31 12:49 +1000
              Re: Division anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-05-31 14:20 +0000
                Re: Division dxf <dxforth@gmail.com> - 2026-06-01 12:47 +1000
              arithmetic shift right (was: Division) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-05-31 14:43 +0000
                Re: arithmetic shift right dxf <dxforth@gmail.com> - 2026-06-01 18:18 +1000
      Re: Forth for a balanced ternary machine Hans Bezemer <the.beez.speaks@gmail.com> - 2026-06-01 23:23 +0200
    Re: Forth for a balanced ternary machine Matthias Koch <m.cook@gmx.net> - 2026-05-28 13:36 +0200

csiph-web