haha!

i said it earlier, two-complement sux badly :)

it wouldnt be such a headache and there would be no problems if everyone used sign bit + amplitude notation for relative numbers. i m sure there are thousands of examples where code would be simpler. And almost no case where it would in fact be harder.

one of these days i think i will draw the schematics of the simple add/sub ALU again and post it.
imo its not more complicated, after all, currently, to do a sub you must do a neg. doh!

bye
Thought I'd put this in the Heap or the Crusades, where it belongs.
Posted on 2004-01-15 23:55:37 by tenkey
I want my -128 :grin:. I don't like "xor eax,-0". If I need some step generator (triangle sound/video wave output) I wouldn't like to fight the exceptional -0. For an year and a half coding experience I have never ever regretted -1 = 11111111. My 2 cent :)
Posted on 2004-01-16 00:29:19 by Ultrano
I like two's-complement because when we are doing unsigned work we get an extra bit of percision. I don't see another way to get that extra bit and have all the operations work in a logical manner.
Posted on 2004-01-16 07:13:24 by bitRAKE
I think 2 complement's is logical and plain simple to understand, at least for me

I agree i have to take a littke care with it,
and it took me 2 days to understand a long time ago when i started learning
numbers/notations inside computers

but it generates some neat tricks also like in doing an "sub" with an "add" ;)

"-0" :grin: ouch
Posted on 2004-01-16 07:55:01 by BogdanOntanu
To HelloWorld,

Most programmers use HLLs, so code complexity won't change one whit.

Got an engineering or physics problem involving matrices, vectors, and equations? You won't care about internal representation -- you'll care about precision and accuracy, and want results printed and entered in decimal notation.

Need a business application involving quantities and costs? You won't care about internal representation -- you'll want decimal rounding, and results printed and entered in decimal notation.

Got a web site with a database behind it? You won't care about internal representation -- you'll want a data type that will represent all the values you want represented.

=====

Yes, it is possible to build a signed-magnitude computer. They have built in the past, and they can be built again.

You are probably going to need to build it yourself. Good luck trying to convince someone else to build it.
Posted on 2004-01-16 19:05:59 by tenkey
wow! i ve started a "crusade" thread! yes ! :)

ultrano:

I want my -128 . I don't like "xor eax,-0". If I need some step generator (triangle sound/video wave output) I wouldn't like to fight the exceptional -0. For an year and a half coding experience I have never ever regretted -1 = 11111111. My 2 cent


you wouldnt have to fight anything of course , the je/jz instruc would do it for you.
wow! it would in fact have ONE BIT LESS to check ! :) :) :)

bitrake:

I like two's-complement because when we are doing unsigned work we get an extra bit of percision. I don't see another way to get that extra bit and have all the operations work in a logical manner.

still some ppl who doesnt understand ,but its my fault.
i would have add/sub implemented as now for unsigned, PLUS iadd/isub for signed. just diffrent representations. so for unsigned its still 0..255.


bogdan:

but it generates some neat tricks also like in doing an "sub" with an "add"

pardon me but i really fail to see any beauty in that. more of a obfuscated hack. but hey, evryone sees things his way... just take care not to be influenced by what has been there for ages...:)

tenkey:

Most programmers use HLLs, so code complexity won't change one whit.

Got an engineering or physics problem involving matrices, vectors, and equations? You won't care about internal representation -- you'll care about precision and accuracy, and want results printed and entered in decimal notation.

you are really right here. (but i already recognized myself that there would probably be no more gain than there would be in reordering the gdt structs to make all bit fields contiguous... still it would be nicer :) )
BUT for problems like ultrano's rounding towards infinity 2 complement IS more error-prone imho , if you do some test/and/or/etc.

anyway i should post the circuitry of my evil machine :) but i m too lazy to draw it and it must already exist...:)
Posted on 2004-01-24 19:09:59 by HeLLoWorld
I dont have problems with the -0... follow this... :D, also I dont have any opinion in what is best..., but two complement is good... also bit sign is used in other cases....


follow this:

x^n/(x+8)
= xx^(n-1)/(x+8)
= (x-0)x^(n-1)/(x+8)
= (x-8+8)x^(n-1)/(x+8)
= {[(x+8)x^(n-1)]/(x+8)}-8(x^(n-1))/(x+8)
= x^(n-1)-8(x^(n-1))/(x+8)

this is a part of a solution..., also you can +0, but is the same that -0... there no exist problem.

like you see have sense the -0 ;)

Have a nice day or night.
Posted on 2004-02-03 23:14:08 by rea
Originally posted by HeLLoWorld
wow! i ve started a "crusade" thread! yes ! :)

but it generates some neat tricks also like in doing an "sub" with an "add"

bogdan:

pardon me but i really fail to see any beauty in that. more of a obfuscated hack. but hey, evryone sees things his way... just take care not to be influenced by what has been there for ages...:)


Is it still a hack when you have run out of regs? :grin:



;////FixCallTarget/////////////////////////////////////////////////////////////
mov ebx,SIZEOF MAPSIZE
lea eax,RELOC[SIZEOF Ientry/4] ;Load highest address of RELOC
^^^ this might need to be mov, dont have the project with me now.
FixCallTarget:
mov ecx,dword ptr MAP[ebx-MAPITEMSIZE]
mov edx,dword ptr TARGET[ebx-MAPITEMSIZE]
function

add edx,eax ;eax = -index ie. -4,-8 etc.
mov esi,[edx]

mov edi,ecx
sub edi,esi
not edi
mov [ecx-3],edi
sub ebx,8
jnz FixCallTarget


I was assuming there would be a stack frame, so no EBP.
Posted on 2004-02-04 00:16:23 by ThoughtCriminal