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