Hi all,
There is analog problem at negabinary number system. For example:
(5#_2)#:10
0 _1 0 _1 0
(5#_2)#:_10
_1 _1 _1 _1 0
It is true, if we will using (0 _1) digits.
Else my solution
-(5#_2)#:-( 10)
1 1 1 1 0
-(5#_2)#:-(_10)
0 1 0 1 0
The inverse problem is true.
_2#.0 1 0 1 0
_10
_2#.1 1 1 1 0
10
Regards,
Istvan
2007/6/3, Geoff Canyon <[EMAIL PROTECTED]>:
I'm reading through J for C Programmers. I haven't been a C
programmer since before C++, but it seems to strike the right chord
for me.
I hit the section on numbers where it says, "16b1f (equivalent to
0x1f; the 16b indicates a base-16 number)"
So immediately I thought, "I suppose that handles other bases besides
16," and sure enough it does.
Then I thought back to a math competition I was once in, where they
first had a speaker talk about a subject that the competitors
presumably had never been exposed to before, and then had us take a
test on the subject.
The subject of the talk was negative bases. For example base negative
3, where 120 is equal to
1*(-3)^2 + 2*(-3)^1 + 0*(-3)^0 = 3
As an aside, one interesting aspect of negative bases is that you
never need to negate a number. For example, -7 = 1202.
So having discovered that J seemingly handles arbitrary bases, I
tried negative bases, and sure enough, it works:
_3b1202
_7
_That_ was a pleasant surprise!
regards,
Geoff
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm