How does division work in MIX?

纵饮孤独 提交于 2019-12-04 07:38:57

So I kind of figured it out myself.

If you do the division by hand, by converting the bytes into a single number you will get -210,501,825 (if you're using the smallest kind of byte - which is 6 bits (!) in Knuths book). Divide this by -128, which is the value in location 1000 using the same bytesize.

The quotient is 1644545, the remainder 65, the sign will be postive since both numbers are negative. If you store 1644545 in rA and 65 in rX, you will get

|+|0|6|17|32|01|
|-|0|0|0|1|1|

using the smallest bytesize (which holds 64 numbers). Since Knuth never assumes a particular bytesize in his examples, rX has a number of question marks. The sign of rX is always the previous sign of rA.

Edit: I used the very handy MixEmul utilty to play around with the registers of MIX. This is a pretty nice MIX implementation done in .NET

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!