[retroforth] Re: unwanted '-' printing hex words

  • From: "Helmar Wodtke" <helmwo@xxxxxx>
  • To: retroforth@xxxxxxxxxxxxx
  • Date: Mon, 24 Jan 2005 17:49:23 +0100

retroforth@xxxxxxxxxxxxx schrieb am 24.01.05 16:34:03:
> 
> > > I'm wondering if any other bases should have the - displayed when
> > > printing. For hex and binary it doesn't make sense, but for decimal
> > > and maybe octal it does. Consider this:
> > >
> > > decimal -10 .
> > > 10
> > >
> > > that would *not* be the right response IMO.
> > But 4294967286 would be the right answer.
> 
> I'll have to disagree here. If I put -10 on TOS, and tell the system
> to display TOS, I want to see -10 as the result; not something like
> 4294967286. RetroForth's words make use of signed integers; if we need
> unsigned math/output, define other words to handle them.
I've no problem with a word . that outputs signed integers. But same example as 
yours:

hex -a
.
FFFFFFF6 

Why should it be evident to have different behaviour of . depending on the used 
base @? I've put -a on the stack and I want to see -a as I see -10 with 
decimal. Next idea someone could have for . could be that if it outputs in 
octal, it should always output a trailing zero... I dont think making . too 
smart is a good idea. If someone wants to have unsigned output, he should use a 
word u. or similar, if . outputs signed.

Bis dann,
Helmar
helmwo@xxxxxx


-- Binary/unsupported file stripped by Ecartis --
-- Type: application/x-pkcs7-signature
-- File: smime.p7s
-- Desc: S/MIME Cryptographic Signature



Other related posts: