开发者

Comparison in Redundant binary representation RBR

How can I compare two numbers in the form of Redundant binary representation RBR ? Any Idea 开发者_如何学JAVA?


This page has some information about RBR. This also includes a subtractor and a converter. What you do to find out, if two RBR numbers are equal is to subtract both numbers and then check, if the result matches one of the representations of zero.

Finding out, if a number is smaller than zero is a little bit harder: You have to find the first RBR digit (r_k and s_k in the article), which is not zero, starting from the most significant digit. If it is negative the result of the subtraction is negative. Otherwise the number is positive. So to sum it up, find the first pair that is either "00" or "11". If it is "00" the number is negative, positive otherwise.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜