Re: negative hex



On Sat, 28 Jun 2008 18:11:25 +0200, Frank Buss <fb@xxxxxxxxxxxxx>
wrote:

John Larkin wrote:

Is there a convention for negative hex numbers?

-0xFEEE

or

0x-ABCD

I would use the first one, because this would be the convention for using
in C programs. But it depends on the language. E.g. in Forth you can switch
the context and any numbers are interpreted and printed with the new radix:


Thanks; I'll use the first one.


hex ok
-babe cafe +
. 1040 ok

PS: -0xfeee is not possible, if you use 16 bit, because usually they are
saved as two's complement.

Sure it's possible. Poke 0xFEEE into a 16-bit register, then negate
it. So -0xFEEE = 0x0112.

John

.



Relevant Pages

  • Re: Selective snipping: was/Re: Selective Memory (was) Re: Name calling, and other playground games
    ... people's reason lext they close their minds to you; ... Language is a convention, an art ... Government" and that the "Supreme Court" was initially referred to as ...
    (alt.gathering.rainbow)
  • Re: Article on Finno-Ugric in the Economist
    ... > You quoted that the Prime Minister said that a convention will be applied ... > "in papers concerning Government statistics". ... > language, not in some no man's land between languages. ... > a more fundamental norm, up to the level of ultimate values such as ...
    (sci.lang)
  • Re: Can someone spot the error here?
    ... Of course, most compilers register optimize ... remake the language so that all such "inconveniences" are removed, ... With the earliest and simplest compilers, ... as programming comfort) than optimization preferences which are ...
    (comp.lang.pascal.misc)
  • Re: Why so little parallelism?
    ... I've worked on several benchmark teams and have to sweat various issues. ... (which got suceeded by Functional Language or FL). ... can fit on it while the short term memory (register space) can only ... A number of things killed APL. ...
    (comp.arch)
  • Re: Code generation from the Gospel according to f0dder
    ... direct pushes of memory over register loads then pushing the register, ... knew a little of the old fashioned basics but its fair to say that ... C is by no means an easy language to learn or write ... object modules so writing assembler in PB is writing its native code ...
    (alt.lang.asm)

Quantcast