agorithm to finding smallest signed number in array

Status
Not open for further replies.

david90

Advanced Member level 1
Joined
May 5, 2004
Messages
423
Helped
9
Reputation
18
Reaction score
4
Trophy points
1,298
Activity points
3,611
What is the best way to do comparison between signed numbers? Is there a way to convert a signed number into an unsigned form? For example, If I have -50, is there way to convert it so that it becomes 50? It would be easier to compare wih other numbers. Hope I making sense.
 

What hardware and which programming language? Equality comparison or magnitude comparison? In most systems, signed and unsigned comparisons are equally fast.

You can convert -50 to 50 by using an absolute value operator or fuction. However, that's no good for comparing signed numbers, because two numbers such as -33 and 33 would then appear to be equal.
 

i'm using pcspim. It is a mips emu.

Comparing signed number is direct until I get to 128. After it is backward. I need help on developing an algorithm that will let me compare signed numbers to see which is bigger or smaller

Thanks
 

Sounds like you want to code an 8-bit signed compare in MIPS32 assembler language. You may have better luck asking your question in a MIPS discussion forum, instead of this PC forum.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…